iDevGames Forums
Carbon events - Printable Version

+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Game Programming Fundamentals (/forum-7.html)
+--- Thread: Carbon events (/thread-7733.html)



Carbon events - sealfin - May 29, 2002 01:27 PM

ok, I've got this event code (a modified quit handler)...
Code:
    EventTypeSpec    quitEvent[] = {kEventMouseDown};
    EventHandlerUPP    quitEventHandler;
    EventHandlerRef    quitEventHandlerRef;

...

quitEventHandler = NewEventHandlerUPP((EventHandlerProcPtr)do_QuitEventHandler);
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...


Carbon events - OneSadCookie - May 29, 2002 01:56 PM

GetApplicationEventTarget() with brackets. You have to call the function, not pass its address Smile


Carbon events - sealfin - May 29, 2002 02:11 PM

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