Topic: Hiding a panel and resizing form
I have a resizable form with a vertical splitter and two panel.
When panel1 is not visible (on click of hide panel1 button) I like the form resize - width reduced as much as hidden panel width. When panel1 shown then form width increased as much as panel1 width - original state.
var Splitter : TSplitter;
// Form1 Vertical Splitter
procedure Form1_OnShow (Sender: string; Action: string);
begin
Form1.Panel1.Align := alLeft;
Splitter := TSplitter.Create(Form1);
Splitter.left := 200;
Splitter.height := 350;
Splitter.Parent := Form1;
Splitter.Align := alLeft;
Splitter.Width := 8;
Splitter.Beveled := True;
Form1.Panel2.Align := alClient;
end;
// SHOW / HIDE LEFT PANEL /////////////////////////
procedure Form1_btnHideLeftPanel_OnClick (Sender: TObject; var Cancel: boolean); // Hide <<
begin
Form1.Panel1.Visible := False;
Form1.btnShowLeftPanel.Visible := True;
Form1.btnHideLeftPanel.Visible := False;
//Splitter.TSplitter.Visible := False (Form1);
//Form1.Width := - Form1.Panel1.Width;
end;
procedure Form1_btnShowLeftPanel_OnClick (Sender: TObject; var Cancel: boolean); // Show >>
begin
Form1.Panel1.Visible := True;
Form1.btnShowLeftPanel.Visible := False;
Form1.btnHideLeftPanel.Visible := True;
//Splitter.TSplitter.Visible := True (Form1);
//Form1.Width := + Form1.Panel1.Width;
end;
Please see the attached sample project if needed.
God... please help me become the person my dog thinks I am.