On Oct 21, 2008, at 6:44 AM, Dalzhim Dalzhim wrote:
Well the concept is pretty simple. When an instance of NSResponder doesn't handle a specific event, it is passed up on the responder chain. Instead of subclassing NSTableView or NSOutlineView, it is only necessary to insert a new NSResponder instance in the responder chain, after the table view or the outline view so that it handles this case.

Inserting a responder in the responder chain is pretty easy. Once you have instantiated your responder, simply set it's nextResponder to the nextResponder of the table view and then set the table view's next responder to your own responder. And there you go, it has been inserted in the linked list.


Yes -- but I don't know how that is any easier; this approach still requires you to subclass. One might as well keep the logic in the same place (the table view).

Also, Andy said:

It's a lightweight subclass that (at a glance) seems to take the same approach as you did, but abstracts the behavior into delegate methods.

I agree; a delegate/datasource abstraction is a good idea, but please, don't use the names recommended in that posting (ie:deleteSelectionFromTableView:). Instead, make it specific to your subclass, ie: myTableView:deleteRows: (etc.). Using the generic "tableView" name could conflict with NSTableView delegate methods that may get added in a later version of the OS.

thanks!

-corbin


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to