Solved

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

Posted on 1998-12-10
6
223 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
ID: 1350502
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
ID: 1350503
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
ID: 1350504
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
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
LVL 7

Expert Comment

by:BlackMan
ID: 1350505
0
 
LVL 2

Accepted Solution

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

Author Comment

by:kdw
ID: 1350507
Man that was easy.  thanks.
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

803 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