I have recently experienced some of these same issues.

You can check out the message:

http://lists.apple.com/archives/cocoa-dev/2009/Mar/msg00179.html

for what I was concerned with.

As best I can determine, a NSTextView relies upon a NSScrollView to handle it's scrolling behavior. Unfortunately, there does not appear to be any way to place a fieldEditor inside of a NSScrollView in order to provide this behavior - but I haven't had that confirmed by anyone.

What I ended up doing is creating a NSTextView inside of a NSScrollView on the fly and using that as my field editor.

Although, I suppose creating a NSTextField would have worked as well...I may try switching to that as it would be less code.


On Mar 3, 2009, at 10:04 PM, Luke Evans wrote:

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?

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to