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 (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com