click in NSButtonCell in NSTableView without selecting table row?
click in NSButtonCell in NSTableView without selecting table row?
- Subject: click in NSButtonCell in NSTableView without selecting table row?
- From: Dan Rowley <email@hidden>
- Date: Mon, 27 Apr 2009 13:43:09 -0700
Hello - I've done multiple searches and seen this topic discussed, but
none with a solution that doesn't feel like a hack. I have an
NSTableView, and one column that contains an NSButtonCell. I would
like the user to be able to interact with this cell without the
selection in the table changing. In the documentation for -
tableView:shouldTrackCell:forTableColumn:row: , it says "For example,
this allows you to have an NSButtonCell in a table which does not
change the selection, but can still be clicked on and tracked," yet
I'm not exactly sure how to actually achieve this end.
I return YES from the delegate method, then indeed my button works
correctly (the data source gets the expected setObjectValue message),
but the selection of the table also changes. The obvious first
solution is to override tableView:shouldSelectRow:, yet this gets sent
BEFORE shouldTrackCell, so I'm not really sure where to go from here.
Do I have to gawk at the current mouse event in shouldSelectRow: and
return NO if it appears that the mouse went down in the button cell?
This feels harder than it ought to be.
Am I missing something painfully obvious?
Thanks!
Dan
_______________________________________________
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