Manual set height of button lazarus / 43-Android ---------------------------------------------------------------------- las · 2019-09-17 20:46 Hi! I put two buttons on the form jButton1, jButton2. The text in jButton1 takes 2 lines The text in jButton2 takes 1 lines Coded: jButton1.LayoutParamHeight := lpWrapContent; jButton2.LayoutParamHeight := lpExact; jButton2.height:=jButton1.height; JButton2.UpdateLayout; But height of jButton2 not equal height of jButton1 on screen. Why? What wrong? ---------------------------------------------------------------------- zorfox · 2019-09-17 21:52 This works but may cause issues across devices...  jButton1.LayoutParamHeight:=lpExact;   jButton1.Height := 300;   jButton2.LayoutParamHeight:=lpExact;   jButton2.Height := 300; ---------------------------------------------------------------------- las · 2019-09-17 22:01 The problem is in different devices. It is necessary that the size of the large button is determined automatically. ---------------------------------------------------------------------- zorfox · 2019-09-18 16:56 There is no [left , top, width, height] exposed at run time. As far as I know, height properties will need to be derived from the parent. Unfortunately, jButton2.Parent := jButton1 won't work. You'll need to use some sort of container such as a jPanel. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   jButton1.Parent := jPanel1;   jButton1.LayoutParamHeight := lpMatchParent;  jButton1.PosRelativeToParent := [rpTop,rpLeft];  jButton1.Text := 'This is' + #10 + 'two lines';   jButton1.Parent := jPanel1;  jButton2.Anchor := jButton1;  jButton2.PosRelativeToAnchor := [raToRightOf,raAlignTop];  jButton2.LayoutParamHeight:=lpMatchParent;  jButton2.Text := 'This is one';  Here is a good explanation about auto-sizing and layout on the lazarus Wiki page. Maybe you can come up with a better solution after digesting that. https://wiki.freepascal.org/Autosize_/_Layout ---------------------------------------------------------------------- las · 2019-09-18 20:23 In your example, the height of the buttons is generally not clear what, because the height of the jPanel is not tied to the height of jButton1, which is automatically calculated.