Best way to access data when subclassing NSTableView?
Best way to access data when subclassing NSTableView?
- Subject: Best way to access data when subclassing NSTableView?
- From: Hank Heijink <email@hidden>
- Date: Thu, 13 Sep 2007 10:48:55 -0400
Hi all,
I'm subclassing NSTableView to implement cut & paste and to catch the
delete key. I've populated my table with bindings, and right now, I'm
wondering about the best way to get the selection in the table for
cutting and deleting objects.
My application is a standard document-based one, and the table is
part of a window in MyDocument.nib. That nib-file also contains an
array controller that makes sure my NSMutableArray (an instance
variable of MyDocument) shows up in the table. I've made MyDocument
the delegate of the table, and in my -cut: method in my NSTableView
subclass, I get the selection like this:
NSArrayController *controller = [[self delegate] myArrayController];
NSArray *selection = [controller selectedObjects];
This approach requires the subclass to know the name of the array
controller in its delegate, which limits the generality of the
subclass considerably. Is there a more general way to get at the
table data? It seems there must be, and I hardly think nobody else
has solved this, so I apologize if I missed the relevant info.
Thanks very much!
Hank
_______________________________________________
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