• 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: Handling menu actions in doc-based apps
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Handling menu actions in doc-based apps


  • Subject: Re: Handling menu actions in doc-based apps
  • From: Paul Lynch <email@hidden>
  • Date: Thu, 30 Mar 2006 13:47:01 +0100


On 30 Mar 2006, at 12:13, Dan Price wrote:

Here’s the situation. I have my menubar in
MainMenu.nib and my model in MyDoc.nib. I need to have
menu-items linked to actions in the model but this
doesn’t seem to be possible because the doc instance
is in the other nib. I can sort-of get it work by
adding the doc-action names to the FirstResponder
class in MainMenu.nib, connecting the menu items to
those and ensuring the document view has like-named
actions and is the First Responder. This isn’t ideal
because it means using the document-view to pass on
actions to the NSDocument subclass. Am I missing something?

To be blunt, yes. Read up on MVC, first responder chains, and nil value responders.


http://developer.apple.com/documentation/Cocoa/Conceptual/ CocoaFundamentals/index.html
http://developer.apple.com/documentation/Cocoa/Conceptual/ BasicEventHandling/Concepts/AboutRespChain.html
http://developer.apple.com/documentation/DeveloperTools/Conceptual/ IBTips/Articles/MakingConnections.html


An NSDocument subclass, presumably in MyDoc.nib, is not a model. First Responder is not a class, it's some sort of dummy target for IB connections, if you like. Implement your actions in your NSDocument subclass, add them to first responder - that's all.

Paul


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Handling menu actions in doc-based apps (From: Dan Price <email@hidden>)

  • Prev by Date: Re: single-document application
  • Next by Date: Re: Pop up window ala msn messenger
  • Previous by thread: Handling menu actions in doc-based apps
  • Next by thread: [NSapp mainMenu] returns nil
  • Index(es):
    • Date
    • Thread