Link to home
Start Free TrialLog in
Avatar of bor061297
bor061297

asked on

Form ONMinimize Event, how?

How to get informed when main form is minimized,
(or maximized again)
Avatar of inter
inter
Flag of Türkiye image

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
Avatar of BoRiS
BoRiS

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
ASKER CERTIFIED SOLUTION
Avatar of michaue
michaue

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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
Can't blame someone for trying ....

And when you have an answer DON'T use the comment option ....
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
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
OK OK, but still then this question just lies there and gets historic or should I say pre-historic.