NSOutlineView editing & selection issues
NSOutlineView editing & selection issues
- Subject: NSOutlineView editing & selection issues
- From: "l.m.orchard" <email@hidden>
- Date: Thu, 23 Aug 2001 11:46:53 -0400
Okay, I found the DragNDropOutline example and I now have a happy start on
an outline document editor after carving up and adapting the code.
The thing now is, I'm trying to modify the editing behavior of the outline.
What I want is this: Select an existing item in the outline, start
typing. With the first letter struck, a new item is created under the
selected item and initialized with that first letter. Further input edits
the new item. Then, when return is hit, editing stops and the new item is
selected. So, to add new items to the outline, you just type and hit
return after each item. Trying to make it very streamlined.
My problems are two fold:
First, is initializing and editing the new item. I successfully create a
new item, and initialize it with a keyDown event's characters, if the
characters are all allowed within an item. The problem, though, is when
the item editor appears, the insertion point is before the first character,
so the rest of the typing appears in front of the first character. If I
call [outlineView editColumn:0 row:newRow withEvent:nil select:YES]; then
the selection of course wipes out the first character I place there,
altogether.
So, is there anyway to start editing a column with the insertion point at
the *end* of the column, without selecting all?
Second problem is that, after return is hit, editing moves onto the next
*existing* item. I just want return to complete the edit of the current
new item, and then stop with that new item selected. I've tried playing
with selectionShouldChangeInOutlineView: and
outlineViewSelectionIsChanging: along with editedRow:
All I've managed so far to do is restrain selection to the new item, but
not to complete the edit. This would work, as the docs say, if I decided
the edited input was invalid, but all I want to do is keep it from
changing to edit the next item on hitting return.
Any ideas?
--
Leslie Michael Orchard <email@hidden>
ICQ: 492905 (home) 11082089 (work)
"...see you space cowboy..."