The menu action doesn't go through Apple Events.
Here's a page doing something similar:
http://forums.macrumors.com/archive/index.php/t-522228.html
They replaced the standard [NSApp terminate:] action with their own quit
action, but it still calls terminate:
________________________________________
From: [email protected]
[[email protected]] On Behalf Of deovrat
singh [[email protected]]
Sent: Friday, March 11, 2011 12:07 AM
To: [email protected]
Subject: Apple Quit event custom handler not working : Beginner
Hi,
I am trying to install a custom Apple quit event handler,but it is not
working.
After running the application I am choosing quit from the menu.
I have not changed the default menu xib file provided by xcode on creating
the cocoa application.
Please tell me what am I doing wrong
This class is the application delegate
@implementation appleEventHandlerAppDelegate
@synthesize window;
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
NSAppleEventManager *manager = [NSAppleEventManager
sharedAppleEventManager];
[manager setEventHandler:self
andSelector:@selector(handleQuitAppleEvent:withReplyEvent:)
forEventClass:kCoreEventClass andEventID:kAEQuitApplication];
}
- (void)handleQuitAppleEvent:(NSAppleEventDescriptor *)event
withReplyEvent: (NSAppleEventDescriptor *)replyEvent {
NSLog(@"Inside the quit event handler ");
}
@end
My intention is to write a custom function for handling quit instead of
using application should terminate.
Thanks.
Regards,
--
Deovrat Singh
_______________________________________________
Cocoa-dev mailing list ([email protected])
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/lrucker%40vmware.com
This email sent to [email protected]
_______________________________________________
Cocoa-dev mailing list ([email protected])
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]