Solved

Main Form, 2nd form - Minimize Main w/o minimizing 2nd form

Posted on 1998-12-10
6
220 Views
Last Modified: 2010-04-04
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
Comment
Question by:kdw
6 Comments
 
LVL 7

Expert Comment

by:ahalya
Comment Utility
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
 
LVL 44

Expert Comment

by:bruintje
Comment Utility
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
 

Author Comment

by:kdw
Comment Utility
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 7

Expert Comment

by:BlackMan
Comment Utility
0
 
LVL 2

Accepted Solution

by:
Thaddy earned 100 total points
Comment Utility
In the closeQuery event of your second form, set Canclose to false. That's all....
0
 

Author Comment

by:kdw
Comment Utility
Man that was easy.  thanks.
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now