Turns out to be a bit more complex.
It will work for your form. But I am still working on the patch (some unexpected side effects...)
Your form is basically "Panel1"
Since I am still working on the patch, I would welcome any feedback.
If you think any of the below is flawed, or may cause future problems, or you have a better idea, or just have a question, ....
I'd rather know now, than later.
But for general purpose. See the image.
- Using crsHomogenousChildResize
- Lazarus 4.99 with patch to check for ccaLeftTop
* 3 Panels. The 2nd and 3rd column are not constraint in any of them.
- Panel1: First column, only top button has MaxWidth.
- Panel2: First column, only top button has MaxWidth and ALL buttons are ccaLeftTop
- Panel3: First column, ALL buttons have MaxWidth and ccaLeftTop
Except for those mentioned all other child controls are ccaFill.
Doing the same in Lazarus 3.n:
- Any MaxWidth constrained child control acts as if it was ccaLeftTop.
- Therefore ccaLeftTop is not needed for any of the constrained children. The results were the same for all (constrained) buttons = ccaFill.
- The 2 non-constrained buttons on Panel2 will follow the difference between ccaFill and ccaLeftTop (and follow the same way as in 4.0)
In none of those examples is the overall width of the first column limited to the constrains at all.
The width of column1 follows the following rule: homogeneous resize based on the biggest preferred width by any contained child control. (*1).
- Panel1: The widest button is either of the 2 non constrained.
- Panel2: The widest button is either of the 2 non constrained.
The difference is, that the buttons are ccaLeftTop. So while the column reserves the same space as in Panel1, the buttons are not scaled to the column width, they just sit in the corner.
- Panel3: The widest button is any of them, and its width is the constrained MaxWidth.
The column is the scaled based on the percentage the MaxWidth had compared to the other columns.
If on any Panel for any single one of the MaxWidth children the ccaLeftTop changes to ccaFill, then the entire first column will be constrained to that MaxWidth.
So far so good.
If we had different MaxWidth, then this allows us to apply the smallest MaxWidth to the entire column. This will happen if all controls that should have their MaxWidth considered for the column are set to ccaFill.
A control with a bigger MaxWidth can shrink to the width given by the other controls smaller MaxWidth. And then they all fill their cell.
But, if we have different MaxWidth, and we want the largest MaxWidth to apply, then the other children (children with smaller MaxWidth) must be ccaLeftTop.
And if MaxWidth are dynamically applied, then those settings must be dynamically adjusted.
Well, I guess its fair game...
(*1)
The "biggest preferred width" is limited by MaxWidth. That is, if a MaxWidth constrained button had a preferred width of e.g 500 (and that was the biggest in the column), then the 500 would not be used, if that button had a MaxWidth of e.g. 100.
(The 100 might be used, if it was the "biggest preferred width" among all the buttons in the column)