I have a form with two panels and a splitter. One panel (panel2) is right-aligned, the splitter is right-aligned, and the second panel (panel1) is client-aligned. When I move the splitter to the left, the width of panel2 increases as expected. When I move the splitter to the right it decreases as expected. When I move the splitter further right than its minSize, then panel2 disappears, the splitter goes all the way to the right, and panel1 takes up all the rest of the client area. I expected that the splitter would not move beyond minSize and panel2 would remain visible with a width equal to the minSize of the splitter. Here is a test application
Form
object Form17: TForm17
Left = 0
Top = 0
Caption = 'Form17'
ClientHeight = 442
ClientWidth = 628
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -12
Font.Name = 'Segoe UI'
Font.Style = []
TextHeight = 15
object Splitter1: TSplitter
Left = 440
Top = 0
Height = 442
Align = alRight
MinSize = 150
ExplicitLeft = 360
ExplicitTop = 216
ExplicitHeight = 100
end
object Panel1: TPanel
Left = 0
Top = 0
Width = 440
Height = 442
Align = alClient
Caption = 'Panel1'
TabOrder = 0
ExplicitLeft = 64
ExplicitTop = 104
ExplicitWidth = 185
ExplicitHeight = 41
end
object Panel2: TPanel
Left = 443
Top = 0
Width = 185
Height = 442
Align = alRight
Caption = 'Panel2'
TabOrder = 1
ExplicitLeft = 448
ExplicitTop = 128
ExplicitHeight = 41
end
end
code
unit Unit17;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtCtrls;
type
TForm17 = class(TForm)
Panel1: TPanel;
Panel2: TPanel;
Splitter1: TSplitter;
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form17: TForm17;
implementation
{$R *.dfm}
end.
This is as designed. Have a look at the splitter's AutoSnap
property:
Determines whether neighboring objects are resized to zero when the splitter is used to make them smaller than MinSize.
Set AutoSnap to false to prevent the splitter from resizing neighboring objects to zero when the user tries to make them smaller than MinSize. When AutoSnap is false, such resize attempts are simply blocked, leaving the neighboring object with a size of MinSize. The default value of AutoSnap is true.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With