Multiple Menus in NSPopupButtonCell / NSTableView
Multiple Menus in NSPopupButtonCell / NSTableView
- Subject: Multiple Menus in NSPopupButtonCell / NSTableView
- From: Greg Hoover <email@hidden>
- Date: Sun, 21 Jan 2007 22:56:49 -0800
I have a table view with a column of nspopupbutton cells. The menu
items in these popups change depending on the object at that row. I
had been using a strategy outlined in several other messages where
the delegate method willDisplayCell:forTableColumn: can be used to
set the menu for each cell before it is displayed. I kept a copy of
each of the menus used in the delegate for this purpose. This worked
most of the time, but a few strange issues came up. Namely the one
outlined in post: "e: Initialising NSTableColumn ??? Continued from :
Setting NSPopUpButtonCell Value from NSTable" where the selected
index would change without cause.
I discovered that the menus in the offending rows were not being
retained correctly (as I expected), probably due to the default use
of dataCell for dataCellForRow. After subclassing NSTableColumn, all
problems seemed to have been resolved.
Just thought I'd share this since I couldn't find any info contrary
to the willDisplayCell: solution.
Greg
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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