• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSOutlineView editing & selection issues
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSOutlineView editing & selection issues


  • Subject: Re: NSOutlineView editing & selection issues
  • From: tyler <email@hidden>
  • Date: Thu, 23 Aug 2001 13:05:13 -0700

On Thursday, August 23, 2001, at 08:46 AM, l.m.orchard wrote:

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?

I might try to hack around this by creating the item with no characters and then putting it into editing mode (which you seem to be able to do), (and only if necessary selecting all of it) and then paste in the characters you are currently initializing it with. This gets in your current characters and the cursor should be at the end. I haven't tried this in the outline view, but I've done this sort of thing elsewhere.

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?

Hmm. This sounds like you need to change the behavior of the underlying NSCell object (which is probably a NSTextFieldCell) in the outline view. But I'm guessing. Also look at the fieldEditor stuff in NSWindow as it explains a lot about what's going on during editing and can perhaps allow you to do one of several things that will make the field editor end editing; makeFirstResponder on something other than the field editor, or at a worst case, endEditingFor: -- See NSWIndow docs for more details).

I'd like to hear about what ends up working :-)

peace,
tyler


References: 
 >NSOutlineView editing & selection issues (From: "l.m.orchard" <email@hidden>)

  • Prev by Date: Re:Doc
  • Next by Date: Re: Nifty Feature - Folding Functions
  • Previous by thread: NSOutlineView editing & selection issues
  • Next by thread: Re: NSOutlineView editing & selection issues
  • Index(es):
    • Date
    • Thread