Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unwanted form size growing on TSplitter move when Panel1.Constraints.MinHeight is set

I have this type of situation (see image), now when I move Splitter1 up in run-time, Panel2 height grows and also Form1 height grows.

But I need to know and block this type of event, when Splitter1 can't be moved up because of Panel1.Constraints.MinHeight is reached, so Panel2 can't be changed of it's height and Form1 too.

Thanks for any help.

preview

-- Edit --
Panel1.Align := alLeft;
Splitter1.Align := alBottom;
Panel2.Align := alBottom;

like image 539
NevTon Avatar asked Nov 01 '13 22:11

NevTon


2 Answers

You can check and deny further sizing in splitter's CanResize event.

procedure TForm1.Splitter1CanResize(Sender: TObject; var NewSize: Integer;
  var Accept: Boolean);
begin
  Accept := ClientHeight - (NewSize + Splitter1.Height) >= Panel1.Constraints.MinHeight;
end;
like image 104
Sertac Akyuz Avatar answered Nov 18 '22 03:11

Sertac Akyuz


Set the Splitter AutoSnap property to false and its MinSize property to the MinHeight of Panel1.

like image 30
Uwe Raabe Avatar answered Nov 18 '22 01:11

Uwe Raabe