Re: Binding the enabled attribute of each NSPopUpButtonCell
Re: Binding the enabled attribute of each NSPopUpButtonCell
- Subject: Re: Binding the enabled attribute of each NSPopUpButtonCell
- From: Dave Geering <email@hidden>
- Date: Wed, 6 May 2009 13:40:54 +1000
On Wed, May 6, 2009 at 12:57 PM, Jerry Krinock <email@hidden> wrote:
>
> Bindings are wonderful. I try and use bindings whenever available -- except
> when I'm dealing with menus.
>
> You see from Ken's response that there are things that just don't fit, or if
> they do fit, it might take a long time to figure out how.
>
> My advice is to not use bindings to create menus. You will write less code
> and spend less time if you create your menus on the fly and use
> target/action.
Bugger, I was afraid someone might say that.
Although, after what Ken said I realised I had not put a lot of
thought into my setup. I don't know how I expected it to work. I'm
almost laughing about it now that I think about what I was trying to
do.
It'd be nice if I could somehow hook into whatever is responsible for
making the menu . . .
- (void) willAddMenuItem:(NSMenuItem *) aMenuItem
toPopUpButton:(NSPopUpButton *)
forObject:(id) yourObject
{
[aMenuItem setEnabled:[[yourObject valueForKey:@"optionAllowed"]
boolValue]];
}
...
...
...
Anyway, enough dreaming, I'll resort to code-based menu making and see
if it really is less hassle.
Thanks for your help,
Dave.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden