• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Simple question on Menus and Document-based apps
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >Simple question on Menus and Document-based apps (From: Henri Häkkinen <email@hidden>)

  • Prev by Date: Re: Releasing an NSBundle
  • Next by Date: Re: Version number objects
  • Previous by thread: Simple question on Menus and Document-based apps
  • Next by thread: Please if some one knows
  • Index(es):
    • Date
    • Thread