Binding the enabled attribute of each NSPopUpButtonCell
Binding the enabled attribute of each NSPopUpButtonCell
- Subject: Binding the enabled attribute of each NSPopUpButtonCell
- From: Dave Geering <email@hidden>
- Date: Wed, 6 May 2009 11:46:25 +1000
Hi List,
I've got a problem when I try to bind the enabled attribute of an
NSPopUpButtonCell.
I have set up an NSArray of custom objects, these custom objects
provide two keys that I want to use for binding (and other keys for
other uses). The two keys are "optionTitle" and "optionAllowed". I
have an array controller in my nib that I bind to my NSArray of custom
objects.
I populate an NSPopUpButton by binding the content to the
arrangedObjects of my array controller with MKP "optionTitle" and this
works fine. I'm trying to bind the NSPopUpButtonCell's enabled
attribute to the arrangedObjects of my array controller with MKP
"optionAllowed" but when my view loads an exception is raised saying
that it cannot create a boolean value from an NSCFArray.
optionAllowed should return an [NSNumber numberWithBool:YES] (or NO)
instance as the value. The value of optionAllowed can change during
runtime and I want this to reflect immediately in my view. If I make
the NSPopUpButton use MKP "optionAllowed" instead of "optionTitle", I
get a list of 1s and 0s which change in real-time when the
optionAllowed value changes in each of my custom objects, but I cannot
set the enabled state of the cell.
Please let me know if I am approaching this the right or wrong way,
and how I can enable or disable (or hide, which also does not work)
certain items in an NSPopUpButton.
Cheers,
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