Re: Simple question on Menus and Document-based apps
Re: Simple question on Menus and Document-based apps
- Subject: Re: Simple question on Menus and Document-based apps
- From: Sherm Pendley <email@hidden>
- Date: Mon, 21 Dec 2009 16:13:04 -0500
2009/12/21 Henri Häkkinen <email@hidden>:
>
> So I have a simple document-based application which has MyDocument with some other classes. The application has the default MainMenu.xib and MyDocument.xib interface files. I would like to add a menu item to the MainMenu, which would call an IBAction method on the MyDocument class. However, the document class and the main menu are on different xib files so I can't make the connection.
>
> What is the Right Way to handle these kinds of things in Cocoa?
Connect the menu item to the "First Responder" in Interface Builder.
At runtime, Cocoa's event-handling machinery will then look through
the responder chain (which includes, among other things, the
currently-active document) to find an object that has the required
action method.
For details, have a look at:
<http://developer.apple.com/mac/library/documentation/cocoa/Conceptual/EventOverview/EventArchitecture/EventArchitecture.html#//apple_ref/doc/uid/10000060i-CH3-SW2>
sherm--
--
Cocoa programming in Perl:
http://www.camelbones.org
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden