Carbon events

Moderator
Posts: 697
Joined: 2002.04
Post: #1
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...

Mark Bishop
--
Student and freelance OS X & iOS developer
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #2
GetApplicationEventTarget() with brackets. You have to call the function, not pass its address Smile
Quote this message in a reply
Moderator
Posts: 697
Joined: 2002.04
Post: #3
heh, plus &quitEventHandlerRef. thanks OneSadCookie, I'd just been confused with passing functions as pointers to NewEventHandlerUPP() beforehand.

Mark Bishop
--
Student and freelance OS X & iOS developer
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  [For David, aarku] Carbon Events OneSadCookie 4 5,328 Mar 5, 2013 10:20 PM
Last Post: SethWillits
  Carbon events in windowed/full screen mode. Help needed. Anton Petrov 1 3,653 Dec 18, 2008 05:35 AM
Last Post: DoG
  Simulating "system idle" events in Carbon applications ascotti 4 3,517 May 2, 2006 03:22 PM
Last Post: OneSadCookie
  Carbon Key Events Nickolei 7 5,085 Nov 17, 2002 03:37 PM
Last Post: codemattic
  Carbon Keyboard Events IBethune 7 5,733 Oct 22, 2002 05:58 AM
Last Post: IBethune