Hey, sorry I never responded.  I just completely forgot.

I don't know what was up when I first read your email, but I just took in the 
wrong way I guess.
After reading your second explanation, I understand what you meant about 
NSNumber.  I was trying to bind the NSComboBox index to a NSNumber object 
mainly because the index was only needed temporarily.

Anyway, for the record, I decided that a NSComboBox was really not the correct 
tool for what I wanted to do anyway.  The HIG says the NSComboBox should allow 
the user to enter a custom value and use the values in the list as 
auto-complete suggestions.  Since I do not want to allow custom values, a table 
view with a search box was a much better solution and works great.

With the table view bound to an array controller, all I needed to do was use 
selectedIndexes to index arrangedObjects to get the information I need from the 
user's selection.

Thanks for the help.


On Oct 13, 2012, at 10:38 PM, Ken Thomases <k...@codeweavers.com> wrote:

> On Oct 13, 2012, at 11:17 PM, Randy Widell wrote:
> 
>> Wow.  Woah.  OK, sorry my ignorance offends.
> 
> I didn't express offense.  At least, I didn't intend to.
> 
>> What in the world was I trying to do…I was trying to bind the selection 
>> index of a NSComboBox to a NSNumber because the Apple Cocoa bindings 
>> document for NSComboBox says the value can be bound to a NSNumber.
> 
> It can be bound to a _property_ of some object where the type of that 
> property is NSNumber.
> 
>> Using -init didn't seem so nonsensical to me.  It could it init with 0.  It 
>> could init with NaN.  But, you're right, -init is not listed in the NSNumber 
>> class reference and that should have been a clue.
> 
> Well, more to the point: an NSNumber is immutable.  It can only have the 
> value it was initialized with.  So, if you instantiate one in a NIB, whether 
> it got a value of 0 or NaN, it would be stuck with that value forever.
> 
> So, my point was: what good is it to bind a view's selection (or whatever) to 
> a constant value?
> 
> 
>> Anyway, cool, I just decided to use -indexOfSelectedItem on a NSComboBox 
>> outlet when the sheet finishes.
> 
> That works, but it would also have worked to bind the value binding of the 
> NSComboBox to a property of some controller object.  My concern is that you 
> were trying to bind it to an object (rather than a property of an object) 
> which betrays a fundamental confusion, and I wanted to bring that out into 
> the open so you could work through it.
> 
> Regards,
> Ken
> 


_______________________________________________

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to