PDA

View Full Version : Carbon events


sealfin
2002.05.29, 04:27 PM
ok, I've got this event code (a modified quit handler)...

EventTypeSpec quitEvent[] = {kEventMouseDown};
EventHandlerUPP quitEventHandler;
EventHandlerRef quitEventHandlerRef;

...

quitEventHandler = NewEventHandlerUPP((EventHandlerProcPtr)do_QuitEve ntHandler);
InstallEventHandler(GetApplicationEventTarget, quitEventHandler, 1, quitEvent, NULL, quitEventHandlerRef);

which gives this error...
cannot implicitly convert
from: (struct OpaqueEventTargetRef *(*__pascal "Pascal")(void))
to : (struct OpaqueEventTargetRef *)
any suggestions people? I'm sure InstallEventHandler is the cause...

OneSadCookie
2002.05.29, 04:56 PM
GetApplicationEventTarget() with brackets. You have to call the function, not pass its address :)

sealfin
2002.05.29, 05:11 PM
heh, plus &quitEventHandlerRef. thanks OneSadCookie, I'd just been confused with passing functions as pointers to NewEventHandlerUPP() beforehand.