Wow.  Woah.  OK, sorry my ignorance offends.  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.

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.

Anyway, cool, I just decided to use -indexOfSelectedItem on a NSComboBox outlet 
when the sheet finishes.



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

> On Oct 13, 2012, at 9:49 PM, Randy Widell wrote:
> 
>> Quick question…  For some reason I cannot find an answer.
>> 
>> I have a NSWindowController subclass and I want to bind the selection index 
>> of a NSComboBox to a NSNumber that is an IBOutlet of the NSWindowController 
>> subclass.  I have a NSNumber object in the window's XIB and the object is 
>> linked to the outlet in the subclass, but the outlet is always nil.
>> 
>> Is there something special about NSNumber?  Other object types seem to work.
> 
> How could that NSNumber be initialized?  It could only be via -init.  A quick 
> test here shows that [[NSNumber alloc] init] returns nil. I.e. it fails, 
> because that's a nonsensical thing to do.
> 
> So is putting an NSNumber in a NIB.  What in the world are you trying to do?  
> In general, it makes no sense to put things other than views or controller 
> objects into NIBs.  NSNumbers are value objects, suitable for the model layer 
> of your app.
> 
> 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