Re: An OutlineView with Finder Editing Behavior
Re: An OutlineView with Finder Editing Behavior
- Subject: Re: An OutlineView with Finder Editing Behavior
- From: Dragan Milić <email@hidden>
- Date: Fri, 28 Oct 2005 15:56:37 +0100
OK, you obviously haven't taken that path I was thinking you have.
You need to subclass NSOutlineView as well. And then, first note this
from the documentation on NSTableView:
"- (void)editColumn:(int)columnIndex row:(int)rowIndex withEvent:
(NSEvent *)theEvent select:(BOOL)flag
Edits the cell at columnIndex and rowIndex, selecting its entire
contents if flag is YES. This method is invoked automatically in
response to user actions; you should rarely need to invoke it
directly. theEvent is usually the mouse event that triggered editing;
it can be nil when starting an edit programmatically.
This method scrolls the receiver so that the cell is visible, sets up
the field editor, and sends
selectWithFrame:inView:editor:delegate:start:length: and
editWithFrame:inView:editor:delegate:event: to the field editor’s
NSCell object with the NSTableView as the text delegate.
The row at rowIndex must be selected prior to calling
editColumn:row:withEvent:select:, or an exception will be raised."
So, you see that when you try to edit a cell, this method is being
called, preparing field editor and making your outline view a
delegate of that text editor. So all you have to do is to implement -
textDidChange in your outline view subclass, there resize the editor
that you obtain as an object that posted the notification your
delegate caught. Now, I've never tried this, but theoretically it
should work. Try and inform us on results.
Milke
On 28.10.2005., at 15:42, email@hidden wrote:
Thanks for your help !
I'll try this ASAP.
"so you've probably created your own text editor and passed it as
"editor" argument, and you've probably passed self (your outline
view) as the delegate. So, in your delegate you should implement -
textDidChange: method, which will receive notifications posted by
your editor and resize the editor. Something like this:"
No I didn't create my own text editor.... I've subclassed
NSTextFieldCell to be able to put image and text in the cell. So
this method take care of selecting just the text part (as in Apple
sample).
So this method is automaticaly called. No need to pass any argument.
How can I do this ? How can I create a text editor ?
I think I have to make a subclass of NSTextField and use this
subclasse as text editor ?
Make my outline delegate of it and that's all ?
And in TextDidChange, calling
selectWithFrame:inView:editor:delegate:... ?
About all tips for save and reload etc, etc, ok. I think i've
understood and I thank you for all theses tips.
See you !
Guillaume
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden