Re: An OutlineView with Finder Editing Behavior
Re: An OutlineView with Finder Editing Behavior
- Subject: Re: An OutlineView with Finder Editing Behavior
- From: Guillaume Gandreau <email@hidden>
- Date: Sun, 30 Oct 2005 09:16:01 +0100
Ok thanks.
your tip on LineBreak works very nice ! thanks !
For text field, I understand what you mean and subclassed
TextDidChange (I already had an outlineview subclass).
I have tried that but it sounds strange.
You're right, in aNotification under TextDidChange, the object is
an NSTextView.
But I can't make it resizing !
I've tried with SetConstrainedFrameSize or SetNeedsDisplayInRect...
But no success. The field stay as it is and text inside had a
strange behavior ( scroll left sometimes...).
Have I to create my own textview in the method you told ? ( - (void)
editColumn:(int)columnIndex row:(int)rowIndex withEvent:(NSEvent *)
theEvent select:(BOOL)flag)
Would NSLayoutManager or TextContainers or other friends be helpfull ?
I don't understand very well usage of theses "Text System archi"
objects...
Thanks !
Guillaume
Le 28 oct. 05 à 16:56, Dragan Milić a écrit :
----------
De : Dragan Milic[SMTP:email@hidden]
Envoyé le : vendredi 28 octobre 2005 15:56:37
A : Cocoa-dev Mailing List
Cc : email@hidden
Objet : Re: An OutlineView with Finder Editing Behavior
Transféré automatiquement par une règle
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