NSTextView - scroll programmatically to place the current line (where the text cursor is) in the middle.
NSTextView - scroll programmatically to place the current line (where the text cursor is) in the middle.
- Subject: NSTextView - scroll programmatically to place the current line (where the text cursor is) in the middle.
- From: Nick <email@hidden>
- Date: Wed, 16 Nov 2011 20:09:36 +0200
Hi
I am trying to implement a behavior of an NSTextView, so that I can have
NSTextView scrolled that way, so the text being entered is always displayed
in the middle (vertically) of the control, to help the user focus his
attention on what he is entering at the moment.
What I don't know - is how to have the current line always in the middle. I
can scroll the view programmatically, but only if the view is "big enough"
in both directions - up and down (i.e, the view has already enough lines
before and after the current line, so it is possible to scroll the view
with a scroll bar (and hence, programmatically too)). But when there's only
one line of text in a text view, I can't scroll it (scroll bar is not
active), however, i still would like to be able to scroll it to position
the current line vertically in the middle of the textview. Is there any
way I could make NSScrollView (which is a container for my NSTextView) be
able to scroll the textview even if there are not too many lines?
Thank you
_______________________________________________
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