Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I use the OnMinimise event in Delphi 3

Status
Not open for further replies.

RibLover

Technical User
Apr 7, 2003
1
US
I'd like to use the application.OnMinimise event in my application. I've tried the following approach to override the onMinimize the event and point it to my event handler in the mainform.

begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.OnMinimize := Tform1.onMinimize;
Application.Run;
end.

and in the main form I used the following construct:

procedure Tform1.onMinimize (Sender: TObject);
begin
Tform1.visible := false; { sample code }
end;

However when the code is complied I get a error message stating that the types procedure and Tnotifyevent are incompatable. Obviously I'm missing something fundmental.

Any suggestions or alternate approaches would be appreciated.

 
seems that you wanna hide the form when minimize don't you?
why don't you try to use the TrayIcon component?


---LastCyborg---
 
You've probably already done this, but in order to assign a procedure to an event you need to make sure that all the parameters are identical.

Another tip, after having had a very quick look at the Delphi help is to investiagte using the TApplicationEvents object (I'm not sure if this is part of Delphi 3) but in Delphi 6 you can drop one on the form (from the "Additional" tab) and then by accessing the "Object Inspector" you have direct access to all the application events.

Hope this helps Clive [infinity]
Ex nihilo, nihil fit (Out of nothing, nothing comes)
 
I just tried the TApplicationEvents object myself, dropped it on the form, brought up the "Object Inspector" and double-clicked the OnMinimize event, placed the following code in the procedure, ran it and it worked well. But I'm just not sure if you have that object in Delphi 3.
Code:
  Self.Visible := False;  // or Visible := False 
                          // or Form1.Visible := False
Clive [infinity]
Ex nihilo, nihil fit (Out of nothing, nothing comes)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top