[Last Call] Learn how to a build a cloud-first strategyRegister Now

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

Form ONMinimize Event, how?

How to get informed when main form is minimized,
(or maximized again)
0
bor061297
Asked:
bor061297
1 Solution
 
interCommented:
Hi,
When you main form is minimized the Application objects OnMinimize is called. Respectively when you press the application icon on the taskbar Application's OnRestore event is triggered. Seek TApplication from Delphi Help and find OnMinimize event example.
Regards, Igor
0
 
BoRiSCommented:
bor

Inter is a hundered percent right, here is a code snippit to show a message when the form is minimized and maximized...

first add this to the type section (looks like this)
type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
    procedure AppMinMessage(Sender: TObject);//here is first
    procedure AppMaxMessage(Sender: TObject);//here is secound

then pass the procedures like so...

procedure TForm1.FormCreate(Sender: TObject);
begin
 Application.OnMinimize  := AppMinMessage;
  Application.OnRestore := AppMaxMessage
end;

procedure TForm1.AppMinMessage(Sender: TObject);
begin
 ShowMessage('Minimize');
end;

procedure TForm1.AppMaxMessage(Sender: TObject);
begin
 ShowMessage('Maximize');
end;

Hope this helps...

Later
BoRiS
0
 
michaueCommented:

     type
       TForm1 = class(TForm)
         procedure FormCreate(Sender: TObject);
         procedure AppMinMessage(Sender: TObject);//here is first
         procedure AppMaxMessage(Sender: TObject);//here is secound

     then pass the procedures like so...

     procedure TForm1.FormCreate(Sender: TObject);
     begin
      Application.OnMinimize  := AppMinMessage;
       Application.OnRestore := AppMaxMessage
     end;

     procedure TForm1.AppMinMessage(Sender: TObject);
     begin
      ShowMessage('Minimize');
     end;

     procedure TForm1.AppMaxMessage(Sender: TObject);
     begin
      ShowMessage('Maximize');
     end;
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
BoRiSCommented:
michaue

Good cutting and pasting there, how about using your own code to answer this question or don't answer it at all...(Orginal, but un-called for...)

Bor

Read the comments first before grading this answer...

Later
BoRiS
0
 
michaueCommented:
Can't blame someone for trying ....

And when you have an answer DON'T use the comment option ....
0
 
JimBob091197Commented:
michaue, wake up!  I think BoRiS added a comment instead of an answer because he didn't want to step on Inter's toes!  (Unlike some people...)

JB
0
 
BoRiSCommented:
michaue

Good cutting and pasting there, how about using your own code to answer this question or don't answer it at all...(Orginal, but un-called for...)

Bor

Read the comments first before grading this answer...

Later
BoRiS
0
 
michaueCommented:
OK OK, but still then this question just lies there and gets historic or should I say pre-historic.
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

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