Re: Checking/unchecking a menu item based on responder chain
Re: Checking/unchecking a menu item based on responder chain
- Subject: Re: Checking/unchecking a menu item based on responder chain
- From: Glen Low <email@hidden>
- Date: Sat, 8 May 2004 18:58:41 +0800
Allan, All:
On 08/05/2004, at 6:04 PM, Allan Odgaard wrote:
On 8. May 2004, at 11:00, Glen Low wrote:
Assuming that according to good MVC/GUI/ [insert alphabet soup]
practice, I don't want the object to "know" about the menu item, is
there a neat way of getting the menu command to check or uncheck when
the object gets to be in the responder chain?
What do you mean by check and uncheck? Are you referring to sending
setState: with NSOnState and NSOffState?
Yes.
The item will automatically manage the enabled state based on wether
or not there is a target in the responder chain which responds to its
action method, and when there is, it will send validateMenuItem: to
that target, where the target can respond with NO to disable the item
(despite being in the responder chain) and it can also do other things
like setting the title of the item or the on/off state (and this
method will be sent each time the item is going to be displayed).
I am aware of that protocol, but it is check and uncheck that I want,
not enable and disable. Hmm... didn't realize you could check and/or
set the title... thanks for that tip.
Cheers, Glen Low
---
pixelglow software | simply brilliant stuff
www.pixelglow.com
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.