Re: NSComboBox bound to NSMutableArray of NSMutableDictionary with NSArrayController?
Re: NSComboBox bound to NSMutableArray of NSMutableDictionary with NSArrayController?
- Subject: Re: NSComboBox bound to NSMutableArray of NSMutableDictionary with NSArrayController?
- From: Quincey Morris <email@hidden>
- Date: Thu, 7 Oct 2010 15:30:48 -0700
On Oct 7, 2010, at 15:14, Laurent Daudelin wrote:
> I just want to have a pre-determined list of items but I'd like the user to have the ability to add new items. That's why I chose the NSComboBox but I see one problem with it. If the user adds one item, that's only a string and it won't be a dictionary. I might have to use a datasource instead.
You could certainly bind the combo box's "value" binding to a string property in your data model, whose setter created a new dictionary when necessary. I'm not certain, though, how you'd be sure the user typed a new "Name" for the purpose of creating a new dictionary or just mistyped an existing one.
Alternatively, use a pop up menu instead, with a "New XXX..." entry as well as the existing names. That's a more traditional way of doing it, which has the benefit of discoverability for the creation function (unlike the combo box solution).
_______________________________________________
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