NSComboBox with NSNumberFormatter DataSource works but not Content binding
NSComboBox with NSNumberFormatter DataSource works but not Content binding
- Subject: NSComboBox with NSNumberFormatter DataSource works but not Content binding
- From: Luke Evans <email@hidden>
- Date: Tue, 04 Sep 2012 23:12:50 -0700
Here's a little mystery that maybe someone can help me with…
I have an NSComboBox for numbers (and hence with an NSNumberFormatter attached to its text field) for which I'd like to populate some items in the drop down list.
I understand that I must present NSDecimalNumber objects for list content and I'd prefer to use bindings for this, so I create a simple NSArray of NSDecimalNumber values and provide this as the Content binding. I get a drop down list with no visible values.
If I give up and use a DataSource, I can instantiate NSDecimalNumbers in the -comboBox:objectValueForItemAtIndex: method and everything works peachy.
Now, I don't know what this means exactly, but I thought I'd implement a value transformer in the Content binding, just to take a look at the values flying by and maybe assert values of NSDecimalValue type. What I find is the transformer is provided with the _whole_ array to transform, rather than individual value elements as I'd expect.
It's hard not to conclude that NSComboBox with an NSNumberFormatter attached is somehow broken for binding, but I'd certainly like to be put right on that score.
In the meantime, I have a workaround in the way of a DataSource. But I'm sad. I like binding things.
-- Luke
_______________________________________________
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