RE : An OutlineView with Finder Editing Behavior
RE : An OutlineView with Finder Editing Behavior
- Subject: RE : An OutlineView with Finder Editing Behavior
- From: email@hidden
- Date: Wed, 2 Nov 2005 09:40:58 +0100
Hi,
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...).
It sounds like if there is a super view on top of my textfield and this
superview doesn't redraw...
Have I to create my own textview in the method you told ? ( -
(void)editColumn:(int)columnIndex row:(int)rowIndex withEvent:(
<file:///Developer/ADC Reference Library/documentation/Cocoa/Reference/A
pplicationKit/ObjC_classic/Classes/NSEvent.html#//apple_ref/doc/c_ref/NSEven
t> NSEvent *)theEvent select:(BOOL)flag)
Would NSLayoutManager or TextContainers or other friends be helpfull ?
I don't understand very well the usage of theses "Text System archi"
objects...
Thanks !
Guillaume
-----Message d'origine-----
De : Dragan Milic [mailto:email@hidden]
Envoyé : vendredi 28 octobre 2005 15:57
À : Cocoa-dev Mailing List
Cc : email@hidden
Objet : Re: An OutlineView with Finder Editing Behavior
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:(
<file:///Developer/ADC Reference Library/documentation/Cocoa/Reference/A
pplicationKit/ObjC_classic/Classes/NSEvent.html#//apple_ref/doc/c_ref/NSEven
t> 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
<file:///Developer/ADC Reference Library/documentation/Cocoa/Reference/A
pplicationKit/ObjC_classic/Classes/NSCell.html#//apple_ref/doc/uid/20000074-
BBCBHAIH> selectWithFrame:inView:editor:delegate:start:length: and
<file:///Developer/ADC Reference Library/documentation/Cocoa/Reference/A
pplicationKit/ObjC_classic/Classes/NSCell.html#//apple_ref/doc/uid/20000074-
BBCCCADE> 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
<mailto: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