Text scrolling with Finder-like label editing. Will a raw field editor (NSTextView) do this, or should I use an NSTextField or NSTextFieldCell?
Text scrolling with Finder-like label editing. Will a raw field editor (NSTextView) do this, or should I use an NSTextField or NSTextFieldCell?
- Subject: Text scrolling with Finder-like label editing. Will a raw field editor (NSTextView) do this, or should I use an NSTextField or NSTextFieldCell?
- From: Luke Evans <email@hidden>
- Date: Tue, 3 Mar 2009 19:04:43 -0800
I've been trying to implement label editing a la Finder, and found
this useful so far:
http://www.cocoadev.com/index.pl?FieldEditorIssues
Essentially, this approach uses the regular NSTextView instance served
up by -[NSWindow fieldEditor:forObject], and recomputes the size of
that is required for the current text. You can then position the
frame of the text view according to taste. This works great up to the
point where I limit the size of the text view reaches the maximum size
for my "text area" (under the icon, like Finder). What I'd like to
have happen then is for the text to scroll like a multiline
NSTextField, so that the caret remains in view, but instead the text
view remains with its top lines visible, and the caret disappears
below along with any typed text, clipped by the frame.
I'm beginning to think that I'm barking up the wrong tree hoping for
text scrolling behaviour to appear from NSTextView. I have no
enclosing scroll view at the moment (though I suppose I could have a
tiny one that has its scrollbar furniture turned off), and I see that
NSTextView is a rather different animal to NSTextField (that owns a
text field cell that in turn provides -setScrollable, which is what I
think I want). However, before I rip the current fieldEditor/
NSTextView stuff apart and try again with creating an NSTextField on
demand, I thought I'd seek a few simple answers:
- Is there any way to get NSTextView to have a text scrolling
behaviour intrinsically? Perhaps this is really only behaviour
produced by an object, like a cell, that wraps the field editor when
its hosted there.
- If this is a non-starter, is it best to create an NSTextField, or
would an NSTextFieldCell work somehow on its own?
-- lwe
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden