On Mar 4, 2009, at 2:37 PM, Luke Evans wrote:

Thanks Eric.

It makes sense, I suppose, that NSTextView wouldn't have an built-in way to do this - it just acts as a 'sheet' of text over which you must create a viewport in the form of a scroll view.

Actually, I've _literally_ just bumped into the reference below, while writing this:
http://developer.apple.com/documentation/Cocoa/Conceptual/TextUILayer/Tasks/TextInScrollView.html
... previously I'd avoided trawling through the text system documentation - probably because I didn't think I was _really_ doing anything for which I wanted The Text System per se ;-)

I think I'm going to try programmatically popping the field editor into an scroll view configured per this note and adding this whole kit and caboodle to to my view hierarchy, rather than just the NSTextView. Hopefully all the resizing will work as I need that. Anyway, I'll report back...

If you succeed, I would be interested.

While I was able to successfully place my own NSTextView into a NSScrollView and have the text scroll as I typed, I was unable to accomplish the same when I tried it with the fieldEditor. Perhaps you will be able to figure out where I went wrong.

But, actually, I ran into another problem involving drawing a focus ring around the field. You should be aware that a NSTextView +NSScrollView will not automatically draw a focus ring around themselves. You will have to do that yourself. Unfortunately, I was unable to get it to work correctly under different circumstances which you may or may not run into - assuming you want a focus ring. I didn't have the time to figure out exactly what was going wrong. My old thread on this topic was:

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

But, it does not cover the problem I had with it.


So, I ended up dumping my NSTextView entirely and, as you mentioned in your initial posting, used a NSTextField to do the editing. An NSTextField will automatically draw a focus ring, seems to know how to do it the right way, and provides all of the text editing support I need.




_______________________________________________

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