Lazarus

Programming => General => Topic started by: Jonny on February 21, 2025, 02:53:06 pm

Title: TSplitter.MinSize only applied to control at one side
Post by: Jonny on February 21, 2025, 02:53:06 pm
I have a TPanel at the top of my form with a TSplitter below it and another TPanel below that.

But Splitter.MinSize only works for the top panel TPanel.Constraints.MinHeight is required for the bottom one.

According to the documentation for TSplitter

Code: [Select]
lazarus/docs/xml/lcl/extctrls.xml

TCustomSplitter.MinSize

Minimum size for either of the anchored controls on opposing sides of the splitter.

MinSize indicates the smallest size allowed for either of the anchored controls
on opposing sides of the splitter. MinSize is used in the MoveSplitter method to
prevent adjacent controls from becoming too small when the splitter is dragged.
The default value for the property is 30 (pixels). When set to 0 (zero), an adjacent
control can be resized until is no longer visible. MinSize does not accept negative
Integer values in the property.

Is this a bug or am I doing something wrong? Minimal project is attached.

(Also, TSplitter has a Color property which is not respected, ParentColor is set to False)
Title: Re: TSplitter.MinSize only applied to control at one side
Post by: wp on February 21, 2025, 03:06:19 pm
Well, documentation can always be wrong out out-dated. But when I look at the source code there is an internal function GetControlConstraintsMinSize(Control: TControl): Integer, and this is called with the arguments CurResizeControl and CurOtherResizeControl. This makes me believe that the constraints are intended to be effective for both sides.

Please file a bug report so that the issue is not forgotten.
Title: Re: TSplitter.MinSize only applied to control at one side
Post by: ASerge on February 21, 2025, 04:08:58 pm
Is this a bug or am I doing something wrong?
I think the constraint property of the panels conflict with TSplitter.
I made a simple project.
Placed Panel1, set Align=alTop.
Placed Splitter1, set Align=alTop, AutoSnap=False.
Placed  Panel2, set Align=alClient.
Everything is working as expected: the minimum size of both panels is 30.
Title: Re: TSplitter.MinSize only applied to control at one side
Post by: Jonny on February 21, 2025, 04:43:57 pm
Quote from: ASerge
Placed Panel1, set Align=alTop.
Placed Splitter1, set Align=alTop, AutoSnap=False.
Placed  Panel2, set Align=alClient.

From the wiki https://wiki.freepascal.org/TSplitter

Quote
TSplitter can work basically in two different modes: via Align (the Delphi way) or via AnchorSides (not supported by Delphi).

I am using AnchorSides for additional flexibility.

Quote from: wp
Please file a bug report so that the issue is not forgotten.

Ok, will do.
Title: Re: TSplitter.MinSize only applied to control at one side
Post by: Jonny on February 21, 2025, 05:28:45 pm
Submitted: https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/41450
TinyPortal © 2005-2018