Re: Core Data NSPopUpButtonCell and NSNumber
Re: Core Data NSPopUpButtonCell and NSNumber
- Subject: Re: Core Data NSPopUpButtonCell and NSNumber
- From: James Maxwell <email@hidden>
- Date: Sun, 23 May 2010 10:48:49 -0700
ah, okay. I got it. Just in case anyone has the same problem in future (probably not, I suppose!), here's what I did:
1) instantiate the desired NSArray of NSNumbers in your controller class
2) create a NSArrayController with the Attribute set to NSNumber and a key for intValue (not sure if the key was necessary...)
3) put an NSPopUpButtonCell in your table's column
4) bind the content of your NSArrayController to your controller, with the path set to point to the array created in 1)
5) bind the content of the table column to the NSArrayController
6) bind the Selected Object for the NSArrayController to the desired object (in my case, it was the "channel" key in the NSArrayController for my Core Data model)
Not certain that this is right, but it works. Hope it saves someone else the trouble later on.
J.
On 2010-05-23, at 10:11 AM, James Maxwell wrote:
> This shouldn't be a difficult problem, but how do I make a NSPopUpButtonCell load a list of numbers, and return the value of the number when selected? Originally I used a ComboBox, with pre-programmed values from IB, but it returned strings, not NSNumbers. This really should be simple, and maybe it is, but I can't find a simple way to do it. I'm using Core Data, and the object I'm trying to set in my model is type Integer 16.
>
> J._______________________________________________
>
> 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
_______________________________________________
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