2009/12/21 Henri Häkkinen <[email protected]>:
>
> 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 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]