• 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: NSPopUpButtons in an NSTableView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSPopUpButtons in an NSTableView


  • Subject: Re: NSPopUpButtons in an NSTableView
  • From: Brian Webster <email@hidden>
  • Date: Fri, 10 May 2002 09:03:05 -0500

On Thursday, May 9, 2002, at 07:46 PM, cocoa-dev-
email@hidden wrote:

I have a column in an NSTableView which displays NSPopUpButtons. I have set
the target and selector of the cell in cell:willDisplay:etc but when my
selector gets called the sender is the tableview and not the popup. I assume
that this is normal, so I am able to get the column and then the cell. But
the cell I receive does not have the correct selected item. Is this because
the column uses the same cell for all rows of the column?

This is correct. I've done a table view using NSPopUpButtonCell, but instead of using target/action on the cells, I instead used the table view data source method tableView:setObjectValue:forTableColumn:row:. When an item is selected from the menu, this will be invoked and the object that will get passed in is an NSNumber containing the index of the menu item that was selected. And no, this is not documented anywhere; I had to figure this out by trial and error.

This method will work fine as long as you have the same menu in each row, but if you have different menus in different rows, then you will want to make a subclass of NSTableColumn to return different menus. You can store them whatever way works best, depending on the reusability of different menus, etc.

--
Brian Webster
email@hidden
http://homepage.mac.com/bwebster
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: NSPopUpButtons in an NSTableView
      • From: email@hidden
  • Prev by Date: AppleShareClient and link errors
  • Next by Date: Re: Best way to push action from 1 thread to another?
  • Previous by thread: NSPopUpButtons in an NSTableView
  • Next by thread: Re: NSPopUpButtons in an NSTableView
  • Index(es):
    • Date
    • Thread