• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSTextView - scroll programmatically to place the current line (where the text cursor is) in the middle.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: NSTextView - scroll programmatically to place the current line (where the text cursor is) in the middle.
      • From: Jens Alfke <email@hidden>
  • Prev by Date: Re: Memory usage from PID
  • Next by Date: Re: About iVars declaration and property
  • Previous by thread: Re: Memory usage from PID
  • Next by thread: Re: NSTextView - scroll programmatically to place the current line (where the text cursor is) in the middle.
  • Index(es):
    • Date
    • Thread