Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 234
  • Last Modified:

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.
0
kdw
Asked:
kdw
1 Solution
 
ahalyaCommented:
Well, if i am right you "Minimize" your application, not the forms. so i don't think that you can do this because MainForm.Minimize actually calls Application.Minimize.

You, ofcourse, can hide the MainForm while displaying Form2 if you prefer.
0
 
bruintjeCommented:
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.
0
 
kdwAuthor Commented:
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
0
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

 
BlackManCommented:
0
 
ThaddyCommented:
In the closeQuery event of your second form, set Canclose to false. That's all....
0
 
kdwAuthor Commented:
Man that was easy.  thanks.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now