If you look in NSEvent.h you will see : #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
/* -eventRef and +eventWithEventRef: are valid for all events */ /* -eventRef returns an EventRef corresponding to the NSEvent. The EventRef is retained by the NSEvent, so will be valid as long as the NSEvent is valid, and will be released when the NSEvent is freed. You can use RetainEvent to extend the lifetime of the EventRef, with a corresponding ReleaseEvent when you are done with it. If there is no EventRef corresponding to the NSEvent, -eventRef will return NULL. */ - (const void * /* EventRef */)eventRef; ... I.e. eventRef is only supported by Apple on 10.5 and newer. Jesper ________________________________________ From: [EMAIL PROTECTED] [EMAIL PROTECTED] On Behalf Of Rangaswamy C T [EMAIL PROTECTED] Sent: Thursday, October 23, 2008 2:42 PM To: cocoa-dev@lists.apple.com; [EMAIL PROTECTED] Subject: Getting Carbon EventRef from cocoa NSEvent Hi All, For some requirement in my product, I have embedded my Carbon window inside Cocoa window using addChildWindow method. For getting my carbon window UI (keyboard and mouse) events working, I had to watch cocoa events for NSWindow of Carbon window and then redispatch carbon eventRef’s to Carbon window using SendEventToEventTarget API. So while converting Cocoa event to carbon events, I used the following piece of code - (void)keyDown:(NSEvent *)theEvent { OSStatus status; //1 EventRef carbonEvnt; //2 carbonEvnt = (EventRef) [theEvent eventRef]; //3 } But the above NSEvent method eventRef is crashing (at 3) on Tiger. But on Leopard it works fine. Am I doing anything wrong here? Thanks _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]