• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Displaying NSPopUpButtonCells in NSTableView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Displaying NSPopUpButtonCells in NSTableView


  • Subject: Re: Displaying NSPopUpButtonCells in NSTableView
  • From: Keary Suska <email@hidden>
  • Date: Fri, 21 May 2010 08:39:31 -0600

On May 20, 2010, at 3:28 PM, James Maxwell wrote:

> hmm... Well, I've tried returning the cell's selectedItem, indexOfSelectedItem, and also:
>
> [[inst MIDI_Inst_Ports] objectAtIndex:[ports indexOfSelectedItem]]
>
> (that is, the port name at indexOfSelectedItem).
> If I NSLog the [ports indexOfSelectedItem] it's always zero. So I'm obviously not understanding how (or when) the cell gets selected.
>
> Maybe the menu/cell selection is a separate process? Do I need to control the popup separately?
> I'll look into NSPopUpButtonCell again, but if anyone see's what I'm missing, please pop me a note.

The first thing to always remember is that the designer of NSTableView was an unabashed sadist. Now that that is out of the way....

What NSTableView needs from you is to tell it what the selected index *should* be, so *it* can set the selected item in the popupbutton. I.e., the tableview wants to control the popupbutton. All you should do is touch it during delegate calls. I believe if you return nil, the first item will be selected.

If every cell's popup will have the same content (albeit varying selections), your sanity will remain intact. Otherwise, I shudder to think....

> On 2010-05-20, at 2:04 PM, James Maxwell wrote:
>
>> 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.


Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"

_______________________________________________

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

References: 
 >Displaying NSPopUpButtonCells in NSTableView (From: James Maxwell <email@hidden>)
 >Re: Displaying NSPopUpButtonCells in NSTableView (From: Peter Ammon <email@hidden>)
 >Re: Displaying NSPopUpButtonCells in NSTableView (From: James Maxwell <email@hidden>)
 >Re: Displaying NSPopUpButtonCells in NSTableView (From: James Maxwell <email@hidden>)

  • Prev by Date: NSPrintInfo printSettings archiving
  • Next by Date: Re: Calling allObjects memory allocation problem
  • Previous by thread: Re: Displaying NSPopUpButtonCells in NSTableView
  • Next by thread: Error 134100 - Core Data models incompatible
  • Index(es):
    • Date
    • Thread