• 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: building a menu at run-time and enabling the items
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: building a menu at run-time and enabling the items


  • Subject: Re: building a menu at run-time and enabling the items
  • From: Glenn Andreas <email@hidden>
  • Date: Fri, 19 Nov 2004 13:07:27 -0600

At 12:02 PM -0600 11/19/04, John Spicer wrote:
I'm building a menu at run-time. I add items to the menu, and each one is given a selector as shown.

The menu items won't enable. I'm not setting a target for the menu item, only a selector. Is this possibly the problem?


It depends.

If your object that implements the routine method is in the responder chain, it will work fine. If it isn't, it won't (unless something else in the responder chain responds to that selector).

By default, the target is NULL which means "look it up through the first responder (and then up the chain)". This is often the way you want things to work if the menu corresponds to something which may have multiple instances (in multiple windows for different document, for example) since otherwise you may end up doing "foo" on the wrong window's "foo view". On the other hand, if it is something that is a singleton (only one exists in your app) you'll want to set the target to that object (since singletons like this rarely are in the responder chain).


--
Glenn Andreas email@hidden <http://www.gandreas.com/> oh my!
Mad, Bad, and Dangerous to Know
_______________________________________________
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: 
 >building a menu at run-time and enabling the items (From: John Spicer <email@hidden>)

  • Prev by Date: Anyone have DropZone?
  • Next by Date: Re: Resize Window with fixed ratio
  • Previous by thread: Re: building a menu at run-time and enabling the items
  • Next by thread: Anyone have DropZone?
  • Index(es):
    • Date
    • Thread