Re: Action on NSButtonCell in NSTableView
Re: Action on NSButtonCell in NSTableView
- Subject: Re: Action on NSButtonCell in NSTableView
- From: Fritz Anderson <email@hidden>
- Date: Tue, 25 May 2004 16:53:55 -0500
It's not that "all buttons have the same action;" NSTableView works by
sharing a single NSCell for each row of an NSTableColumn. There is only
one button cell involved.
What I've found works is, in the action method, ask the table what the
selected row is. That should tell you enough.
[pageRollView selectedRow];
-- F
On 25 May 2004, at 4:19 PM, Pierre Bernard wrote:
I have created a table which uses a subclass of NSButtonCell for data
cell. I have seen differing methods for implementing this and went
with this remarkably simple set-up:
NSTableColumn * column = [[NSTableColumn alloc] init];
ThumbnailCell * dataCell = [[ThumbnailCell alloc] init];
[column bind:@"value" toObject:pageRollController
withKeyPath:@"arrangedObjects.self" options:[NSDictionary
dictionary]];
[dataCell setTarget:self];
[dataCell setAction:@selector(loadPage:)];
[pageRollView addTableColumn:column];
[column setDataCell:dataCell];
[dataCell autorelease];
[column autorelease];
The catch being that all buttons have the same action. I would need to
know which button was pressed. Here I was hoping for the sender
argument to the action to be of some help. Unfortunately the sender
always is the table view not the button cell.
Somebody must have done this and care to share the obvious I am missing
_______________________________________________
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.