• 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: Need help with initializing Menu check boxes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Need help with initializing Menu check boxes


  • Subject: Re: Need help with initializing Menu check boxes
  • From: Glenn Andreas <email@hidden>
  • Date: Fri, 3 Dec 2004 08:45:14 -0600

At 1:38 AM -0500 12/3/04, Laurent Daudelin wrote:
on 02/12/04 22:56, Michael Heinz at email@hidden wrote:

 Hey, all -

 I've got a document-based application that uses a number of toggled
 settings that are controlled by menu items. While I've figured out how
 to set/clear the check box on a menu item when that item is selected, I
 can't figure out how to initialize the check boxes when the document
 loads.

 Actually, I'd like to have those check boxes get updated whenever the
 active document changes (because different documents can have different
 settings).

Any suggestions on how to do this?

Check NSWindow delegation methods.


I use the menu validation routines, since that was you don't need to do anything fancy to track activation/deactivation - if your window/whatever would respond to the item that is checked (or not) the menu validation will call it so you can set the state accordingly, while if it doesn't, it'll just be disabled.

The one drawback of menu validation is that there is only a single routine, which makes it difficult to use categories (since even if the action are in different categories, there is still a single place that handled menu validation associated with those command from different places). It would be nice menu validation did a "validateFoo:" for every "foo:" action (though it's not that hard to have the single validation routine take the selector of the menu item, convert it to a string, make the first character caps, prepend "validate", check if it responds to it, and then dispatch that).

--
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: 
 >Re: Need help with initializing Menu check boxes (From: Laurent Daudelin <email@hidden>)

  • Prev by Date: Re: Swapping isa's (was Re: Hex Edit controls (resknife))
  • Next by Date: Re: (no subject)
  • Previous by thread: Re: Need help with initializing Menu check boxes
  • Next by thread: Re: Need help with initializing Menu check boxes
  • Index(es):
    • Date
    • Thread