The TListView component imposes its own size. Was it a mistake? lazarus / 31-LCL ---------------------------------------------------------------------- J-23 · 2020-05-05 16:54 Hello, The TListView component imposes its own size. Was it a mistake? I have a form with two GroupBox 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 object Form1: TForm1  Left = 355  Height = 620  Top = 120  Width = 996  Caption = 'Form1'  ChildSizing.EnlargeHorizontal = crsHomogenousChildResize  ChildSizing.EnlargeVertical = crsHomogenousChildResize  ChildSizing.Layout = cclTopToBottomThenLeftToRight  ClientHeight = 620  ClientWidth = 996  LCLVersion = '2.0.6.0'  object GroupBox1: TGroupBox    Left = 0    Height = 620    Top = 0    Width = 498    Caption = 'GroupBox1'    TabOrder = 0  end  object GroupBox2: TGroupBox    Left = 498    Height = 620    Top = 0    Width = 498    Caption = 'GroupBox2'    TabOrder = 1  endend         After adding TListView to GroupBox and setting: 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   Align:=clClient  GroupBox changes size instead of adjusting to its size. Result: 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 object Form1: TForm1  Left = 355  Height = 620  Top = 120  Width = 996  Caption = 'Form1'  ChildSizing.EnlargeHorizontal = crsHomogenousChildResize  ChildSizing.EnlargeVertical = crsHomogenousChildResize  ChildSizing.Layout = cclTopToBottomThenLeftToRight  ClientHeight = 620  ClientWidth = 996  LCLVersion = '2.0.6.0'  object GroupBox1: TGroupBox    Left = 0    Height = 620    Top = 0    Width = 589    Caption = 'GroupBox1'    ClientHeight = 602    ClientWidth = 585    TabOrder = 0    object ListView1: TListView      Left = 0      Height = 602      Top = 0    Width = 585      Align = alClient      Columns = <>      TabOrder = 0    end  end  object GroupBox2: TGroupBox    Left = 589    Height = 620    Top = 0    Width = 407    Caption = 'GroupBox2'    TabOrder = 1  endend ---------------------------------------------------------------------- jamie · 2020-05-05 21:20 if you are talking about the 4 pixel differences that could be border spacing defined but when ever you use Client Align it will take the size of the parent client space.. ---------------------------------------------------------------------- J-23 · 2020-05-05 22:59 it's about the width property (GroupBox) which changes from: 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 width:=492 to 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 width:=589  after setting align: = alClient (TListView) where in my opinion it should adapt to the size of the GroupBox ---------------------------------------------------------------------- Martin_fr · 2020-05-05 23:54 As far as I can see it is somehow related to ChildSizing. And the align alClient is not needed. At least in my test, having to containers (groupboxes or panels) side by side, and then adding anything (label, button, listview) to one of them, did affect the size.... No idea why. No idea if by design. ---------------------------------------------------------------------- J-23 · 2020-05-06 01:17 Quote from: Martin_fr on May 06, 2020, 01:54:48 amAs far as I can see it is somehow related to ChildSizing. And the align alClient is not needed. At least in my test, having to containers (groupboxes or panels) side by side, and then adding anything (label, button, listview) to one of them, did affect the size.... No idea why. No idea if by design. ChildSize is set to Form and is responsible for correctly setting GroupBox and it works fine (There are two different columns) Now in these two columns I set individual components for the Button example, I set it to Align = clClient and here I adjust Button to the size of the GroupBox (i.e. it works correctly) Instead of Button, I put TListView and I have resized GroupBox instead of fitted to GroupBox Attached are screenshots that show the problem ---------------------------------------------------------------------- Martin_fr · 2020-05-06 01:37 Ok, on Win10 with Lazarus trunk, I do not need align. Drop anything into the container, and the container is resized. As I said, no idea why. Also no idea if indented, but it would seem odd. ---------------------------------------------------------------------- J-23 · 2020-05-06 19:50 After a closer look at the case, I come to the conclusion that the entire ChildSize mechanism can be repaired because it does not work properly. In addition to the previously described problem with align: = alClient, there is also a problem e.g. with moving the component in any direction (increases or decreases the size of the parent - depending on the direction of shift) Attached is a demo showing this problem (press the button) I checked what Martin_fr wrote about that under Wind 10 he did not need to use alClient by himself extended to the dimensions of his parent. However, or it has something wrong with the Lazarus configuration because it doesn't work for me under Win 10. (Anyway, I would consider it a mistake if it were so) I wonder whether to report this problem to bugtracker, what do you think? ---------------------------------------------------------------------- Martin_fr · 2020-05-06 21:23 I think: Report it. The only doc I can find does not say anything about that behaviour. https://wiki.lazarus.freepascal.org/Autosize_/_Layout#Rows.2C_columns_ and_lines Size depends on the size of the embedded children. Dropping another control on any of those children should not change their size, so I see no explanation. I checked: 1.8.5 and 1.6.5 and 1.0.15 also has the strange behaviour. ---------------------------------------------------------------------- J-23 · 2020-05-07 00:45 I made a bug tracker report: https://bugs.freepascal.org/view.php?id=37030