Re: NSComboBox bug?
Re: NSComboBox bug?
- Subject: Re: NSComboBox bug?
- From: matt neuburg <email@hidden>
- Date: Thu, 31 Oct 2002 12:04:00 -0800
On 10/31/02 at roughly 1:50 PM, thus spake Nicholas Riley <email@hidden>:
>
On Thu, Oct 31, 2002 at 11:29:52AM -0800, matt neuburg wrote:
>
> >Nope, it's a bug that's been there since 10.0. You can't have a combo
>
> >box with a formatter if you want the combo box to work.
>
>
>
> Piffle. Formatters work perfectly well with comboboxes; I use them
>
> all the time. A combination of a formatter and a datasource is a
>
> very powerful way to run a combobox.
>
>
It would be lovely if it were documented somewhere.
What's not documented?
>
> The problem with the above example is that an NSNumberFormatter
>
> expects numeric values, but "0", "1" and so forth aren't numbers;
>
> they're strings. m.
>
>
This makes it impossible to edit the combo box list from IB - again,
>
this is not documented.
Here's what the NSNumberFormatter doc says - this is the first sentence - "Instances of NSNumberFormatter format the textual representation of cells that contain NSDecimalNumbers and convert textual representations of numeric values into NSDecimalNumbers."
Here's what the Data Formatting topic says: "The value of a cell (NSCell) is represented by an object, which in this case would typically be a number object. When this value needs to be displayed or edited, the cell passes its object to the NSNumberFormatter instance, which returns the formatted string. When the user enters a string, or when a string is programmatically written in a cell (using setStringValue), the cell obtains the equivalent number object from the NSNumberFormatter."
Short of banging me over the head with a big stick and yelling in my ear, I don't see how the docs could be telling me any more clearly that an NSNumberFormatter takes and returns a number object value.
Now, if you don't want this behavior, don't use an NSNumberFormatter. There's no problem whatever with having a formatter that takes a string object value; you'll just have to write it yourself, which is very easy to do. Then, the string values that you can enter in IB will work.
m.
matt neuburg, phd = email@hidden,
http://www.tidbits.com/matt
pantes anthropoi tou eidenai oregontai phusei
Subscribe to TidBITS! It's free and smart.
http://www.tidbits.com/
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.