Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 01-22-2001, 08:29 AM
Joackim Joackim is offline
Member
 
Join Date: Jan 2001
Posts: 48
Default Assign NotifyEvent

Im developing a plugin to winamp and I've got a problem.
How do i assign a procedure to a event on a component without using a form? ...

eg

procedure Init;
begin
MyComp:= TMyComp.Create(Application);
MyComp.OnAction:= //?? a standard procedure will not work..

end;


Thanks..
//Joackim Pennerup, Sweden
Reply With Quote
  #2  
Old 01-22-2001, 08:48 AM
Lapince Lapince is offline
Senior Member
 
Join Date: Jan 2001
Posts: 163
Default RE: Assign NotifyEvent

Declare your procedure as :
procedure X(Sender: TObject);
(for a TNotifyEvent)
then Control.Event:=X;
Reply With Quote
  #3  
Old 01-22-2001, 01:03 PM
Joackim Joackim is offline
Member
 
Join Date: Jan 2001
Posts: 48
Default RE: RE: Assign NotifyEvent

To bad.. but the code you gave me resulted in this

"[Error] Main.pas(57): Incompatible types: method pointer and regular procedure"

what to do ?

//Joackim Pennerup, Sweden
Reply With Quote
  #4  
Old 01-23-2001, 09:31 AM
Lapince Lapince is offline
Senior Member
 
Join Date: Jan 2001
Posts: 163
Default RE: RE: RE: Assign NotifyEvent

It just was an example for a TNotifyEvent procedure... Maybe you're not using TNotifyEvent...
Reply With Quote
  #5  
Old 01-23-2001, 10:30 AM
Lapince Lapince is offline
Senior Member
 
Join Date: Jan 2001
Posts: 163
Default RE: RE: RE: Assign NotifyEvent

Sorry, I hadn't understood what you wrote... I gave a bad answer... Can you write your procedure declaration and assignation ?
Another example :

//mainform declaration :
procedure AppMessage(var Msg: Tmsg; var Handled: Boolean);

//Assignation, in OnCreate for example :
Application.OnMessage := AppMessage;

procedure TMainForm.AppMessage(var Msg: Tmsg; var Handled: Boolean);
begin
// code here
end;
Reply With Quote
  #6  
Old 01-23-2001, 12:55 PM
Joackim Joackim is offline
Member
 
Join Date: Jan 2001
Posts: 48
Default RE: RE: RE: RE: Assign NotifyEvent

hmm.... I get the same error as last time....

could it be the fact that I don't have any class, where I declare my procedure..

My file is just a standard unit without any class stuff.. =/

well here is my declaration and assignation...

//declaration:
procedure Hotkey(Sender: TObject; Index: Integer);


//Assignation, in the funtion Init;
HotKeys:= TSaSysHotkey.Create(Application);
Hotkeys.OnHotKey:= Hotkey;


//Joackim Pennerup, Sweden
Reply With Quote
  #7  
Old 01-24-2001, 08:08 AM
Lapince Lapince is offline
Senior Member
 
Join Date: Jan 2001
Posts: 163
Default RE: RE: RE: RE: RE: Assign NotifyEvent

You must create the HotKey procedure !! And it must have a content.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT. The time now is 01:30 AM.


Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2019, vBulletin Solutions, Inc.