• 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: Getting a reference to an NSMenuItem from another nib?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting a reference to an NSMenuItem from another nib?


  • Subject: Re: Getting a reference to an NSMenuItem from another nib?
  • From: Andy Lee <email@hidden>
  • Date: Tue, 14 Jun 2005 12:16:05 -0400

Setting design philosophy aside -- to solve the specific problem of making menu items globally accessible, I would make a class that has a singleton instance with outlets that you can connect to the various menu items. Instantiate the class in IB and make the connections. Or, subclass NSApplication, add outlets for menu items, and make that subclass the File's Owner of MainMenu.nib. This way the menu items become globally accessible either by way of [YourClass singletonInstance] or by way of NSApp. You still can't make connections to the menu items in multiple nibs, but you can send messages directly to the menu items anywhere in your code, as you wanted.

Note that this doesn't address the enabling and disabling of toolbar items, which typically parallel menu items. In my own code I glommed toolbar and menu validation into one -validateItem: method, which I call from -validateMenuItem: and -validateToolbarItem:.

--Andy

_______________________________________________
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: 
 >Getting a reference to an NSMenuItem from another nib? (From: "Theodore H. Smith" <email@hidden>)
 >Re: Getting a reference to an NSMenuItem from another nib? (From: Sherm Pendley <email@hidden>)
 >Re: Getting a reference to an NSMenuItem from another nib? (From: "Theodore H. Smith" <email@hidden>)
 >Re: Getting a reference to an NSMenuItem from another nib? (From: Sherm Pendley <email@hidden>)
 >Re: Getting a reference to an NSMenuItem from another nib? (From: "Theodore H. Smith" <email@hidden>)

  • Prev by Date: Re: Getting a reference to an NSMenuItem from another nib?
  • Next by Date: Over-release *inside* framework when setting NSTextView attributes
  • Previous by thread: Re: Getting a reference to an NSMenuItem from another nib?
  • Next by thread: Re: Getting a reference to an NSMenuItem from another nib?
  • Index(es):
    • Date
    • Thread