kdw
asked on
Main Form, 2nd form - Minimize Main w/o minimizing 2nd form
This has to be easy.
I have a 2 form application. I bring up the main form. One of the functions can display a 2nd form. Now, I want the user to be able to minimize the main form, without the 2nd form being minimized. Minimizing the main seems to hide my 2nd one.
I have a 2 form application. I bring up the main form. One of the functions can display a 2nd form. Now, I want the user to be able to minimize the main form, without the 2nd form being minimized. Minimizing the main seems to hide my 2nd one.
Hi KDW,
Try this
2 forms
form 1 with 2 buttons
form 2 with 2 buttons
this code in unit1
implementation
uses Unit2;
{$R *.DFM}
procedure TForm1.Button1Click(Sender : TObject);
begin
Form1.WindowState := wsMinimized;
Form2.Show;
end;
procedure TForm1.Button2Click(Sender : TObject);
begin
Form2.Close;
Close;
end;
and this code in unit2
implementation
uses Unit1;
{$R *.DFM}
procedure TForm2.Button1Click(Sender : TObject);
begin
Form2.Hide;
Form1.WindowState := wsNormal;
end;
procedure TForm2.Button2Click(Sender : TObject);
begin
Form1.Button2Click(Self);
end;
Hope this helps
br(UINT)je.
Try this
2 forms
form 1 with 2 buttons
form 2 with 2 buttons
this code in unit1
implementation
uses Unit2;
{$R *.DFM}
procedure TForm1.Button1Click(Sender
begin
Form1.WindowState := wsMinimized;
Form2.Show;
end;
procedure TForm1.Button2Click(Sender
begin
Form2.Close;
Close;
end;
and this code in unit2
implementation
uses Unit1;
{$R *.DFM}
procedure TForm2.Button1Click(Sender
begin
Form2.Hide;
Form1.WindowState := wsNormal;
end;
procedure TForm2.Button2Click(Sender
begin
Form1.Button2Click(Self);
end;
Hope this helps
br(UINT)je.
ASKER
That would sort of work, but I really need to:
1)have the minimize come from the minimize border icon
2)Have clicking the TaskBar entry for the program bring back the first window
1)have the minimize come from the minimize border icon
2)Have clicking the TaskBar entry for the program bring back the first window
Check this article: http://www.delumpa.com/tips/forms/forms15.htm
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Man that was easy. thanks.
You, ofcourse, can hide the MainForm while displaying Form2 if you prefer.