Changing the sequence of editing cells in NSTableView/NSOutlineView
Changing the sequence of editing cells in NSTableView/NSOutlineView
- Subject: Changing the sequence of editing cells in NSTableView/NSOutlineView
- From: "Doug Knowles" <email@hidden>
- Date: Thu, 17 May 2007 23:04:14 -0400
My application presents a multi-column outline view where relatively
few of the cells are editable. I'm using the delegate's
outlineView:shouldEditTableColumn:item: method to control which cells
should be edited, but I'm having trouble managing the behavior when
the user completes an edit with Return or Tab.
The problem is that table/outline views want to open the "next" cell
for edit on tab or return. The view code does this by traversing the
cells in the view in column or row order (depending on what key closed
the edit), invoking outlineView:shouldEditTableColumn:item: on each
until the delegate returns YES. In my case, the next editable cell
could be many rows and/or columns away, and this is not useful; I
would prefer to just close out the edit by re-selecting the (entire)
row containing the cell I just edited. The problem is how to get the
outline view to stop looking for a new cell to edit.
I've figured out that NSOutlineView performs the scan for a new cell
to edit in its textDidEndEditing: method. If I override the method, I
can prevent the scan for a new cell to edit, but I lose other
essential behaviors.
My next thought is to override textDidEndEditing:, invoke the
superclass method, then throw an exception from my
outlineView:shouldEditTableColumn:item: and catch it in
textDidEndEditing:. This will prevent the scan, but I still won't
have control over what NSOutlineView's textDidEndEditing: will or will
not accomplish before I throw an exception around it. Therefore, I
don't think this is a robust solution even if it happens to work for
now.
Am I missing something more obvious?
As always, thanks in advance.
Doug Knowles
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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