Re: Displaying NSPopUpButtonCells in NSTableView
Re: Displaying NSPopUpButtonCells in NSTableView
- Subject: Re: Displaying NSPopUpButtonCells in NSTableView
- From: James Maxwell <email@hidden>
- Date: Thu, 20 May 2010 14:04:44 -0700
ah, that makes sense. I'll make the change and see if that fixes it.
thanks, Peter.
J.
On 2010-05-20, at 1:28 PM, Peter Ammon wrote:
>
> On May 20, 2010, at 1:14 PM, James Maxwell wrote:
>
>> I thought I'd change the topic on this, since the content really has changed.
>>
>> I have an table for setting up MIDI instruments with a name, port, and channel. I've got the initial display of options for the table row displaying correctly, and when I make changes to the name, port, and channel, the data object is updated correctly. The only thing left is that the popups in columns 2 and 3 are not holding the selected value. I understand that this is probably because I'm reloading the menu in tableView:objectValueForTableColumn:row, but I'm not sure how to get around it.
>>
>> Here's the code I've got so far. I'm not using an NSArrayController, because that approach was driving me absolutely mental...
>> I've copied all the code (except imports) to be thorough. Logging "Edited MIDIInstrument" at the end shows that the instrument is set up correctly, with the desire name, port, and channel. It's just that the popups always display the 2nd item.
>
> Hi James,
>
> If you have a table view containing an NSPopUpButtonCell, the object value returned by your objectValueForTableColumn: method should be an NSNumber, which contains the index of the item that should be selected. It looks like the attached code is returning the cell itself, which is strange, and I think that's causing the problem.
>
> Hope this helps,
> -Peter
>
James B Maxwell
Composer/Doctoral Student
School for the Contemporary Arts (SCA)
School for Interactive Arts + Technology (SIAT)
Simon Fraser University
email@hidden
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