Re: NSTableView behavior changes
Re: NSTableView behavior changes
- Subject: Re: NSTableView behavior changes
- From: Harry Plate <email@hidden>
- Date: Tue, 17 Mar 2009 17:00:54 -0700
- Thread-topic: NSTableView behavior changes
Graham,
Finally getting back to this problem.
>> 2) I would like my user to be able to select a table entry, and
>> be able
>> to respond to the 'delete' key - by discarding the selected entry.
>> Currently
>> that does not work at all.
>
> You have to make this happen yourself. The controller that is handling
> the tableview will need to respond to the delete key by finding the
> current selection (i.e. calling -selectedRowIndexes on the tableview),
> deleting the corresponding items from the data model and reloading the
> table view.
>
> To respond to the delete key, the controller will need to subclass
> NSResponder and insert itself as the next responder to the table view
> by calling [tableView setNextResponder:self]; . It then needs to
> override -deleteBackward: or whatever.
So far I have tried to accomplish this without success.
1) I defined my controller class:
@interface MCController : NSResponder
2) I then defined (void)deleteBackward:(id)
3) in -awakeFromNib, I set my controller as 1st responder:
[sourceTableView setNextResponder:self]
Sadly, I do not get to the -deleteBackward: method (Xcode bkpnt).
The ui merely beeps when I hit the 'delete' (backward) key.
Currently the table column are not editable; I tried to make editable, but
that had no effect on the behavior.
I also implemented -acceptsFirstResponder (returning YES); that too did not
change the behavior.
I am obviously barking up the wrong tree. Should I subclass NSTableView, and
intercept keys (keyDown)? I am seeing some list topics where folks have done
that.
Comments welcome,
-harry
_______________________________________________
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