[SOLVED] Centering controls on LAMW form lazarus / 43-Android ---------------------------------------------------------------------- maurobio · 2023-06-21 12:59 Dear ALL, Here am I again with what looks a very simple question but (there is always a but!) that can turn out to be yet another bayou of doubts... So, I have a test form with a textview and two buttons. The textview is centered in the screen, with the size and position parameters below: Textview 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 PosRelativeToAnchor = []PosRelativeToParent = [rpCenterHorizontal]LayoutParamWidth = lpWrapContentLayoutParamHeight = lpWrapContent Then, below the textview, I have two buttons, side by side, with the following positional parameters: Left button: 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 Anchor = TextView1PosRelativeToAnchor = [raBelow]PosRelativeToParent = [rpCenterHorizontal]LayoutParamWidth = lpOneThirdOfParentLayoutParamHeight = lpWrapContent  Right button: 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 Anchor = Button1PosRelativeToAnchor = [raBelow, raToEndOf, raAlignBaseline]PosRelativeToParent = [rpCenterHorizontal]LayoutParamWidth = lpOneThirdOfParentLayoutParamHeight = lpWrapContent But ( ) the buttons don't appear centered on the screen as expected (see the attached screenshot)! Could someone please give me a hand? Thanks in advance! With warmest regards, ---------------------------------------------------------------------- Insid3Code · 2023-06-21 17:10 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 Button1Anchor = TextView1PosRelativeToAnchor = [raBelow]PosRelativeToParent = [rpLeft]LayoutParamWidth = lpHalfOfParent          Button2 Anchor = TextView1PosRelativeToAnchor = [raBelow]PosRelativeToParent = [rpRight]LayoutParamWidth = lpHalfOfParent ---------------------------------------------------------------------- maurobio · 2023-06-21 18:53 Hi, @Insid3Code! Thanks for your suggestion, but (always a but!) this is not what I have in mind. Your solution does not really centers the buttons, it stretches them to make them appears centered (which is sort of ugly). What I want is to have the buttons centered, without changing their sizes. Best regards, ---------------------------------------------------------------------- Insid3Code · 2023-06-22 00:28 Ok, if you need to keep your button width... it better to use "jLinearLayout" See animated gif: https://i.imgur.com/bzTiusx.gif FULL lfm source: ---------------------------------------------------------------------- maurobio · 2023-06-22 00:37 Hi, @Inside3Code! Nice demo!!! Thanks a lot!!! I will take a good look at it. BTW, the stretched buttons are not so ugly after all!  With warmest regards, ---------------------------------------------------------------------- maurobio · 2023-06-24 18:47 Hi, Insid3Code! The jLinearLayout did the trick! In fact, this control was exactly what I needed for creating good-looking forms with nicely centered controls in LAMW. Thank you very much! With warmest regards,