Finding the Caret In a clParagraphView-based View
One of the Newton 2.x OS Q&As
Copyright © 1997 Newton, Inc. All Rights Reserved. Newton, Newton Technology, Newton Works, the Newton, Inc. logo, the Newton Technology logo, the Light Bulb logo and MessagePad are trademarks of Newton, Inc. and may be registered in the U.S.A. and other countries. Windows is a registered trademark of Microsoft Corp. All other trademarks and company names are the intellectual property of their respective owners.
For the most recent version of the Q&As on the World Wide Web, check the URL:
http://www.newton-inc.com/dev/techinfo/qa/qa.htm
If you've copied this file locally,
click here to go to the main Newton Q&A page.
This document was exported on 7/23/97.
NEW: Finding the Caret In a clParagraphView-based View (5/12/97)
- Q: I have a view based on
clParagraphView
and would like to find the current position of the caret within that view so that I can scroll to it. Is there a way to do this?
A: Yes, there is a clParagraphView
method called caretRelativeToVisibleRect
that you can use.
This method takes the global coordinates of the visible region of the paragraph view as an argument. It returns either 'inbox,
'top
, 'left
, 'bottom
, 'right
, or nil
. Below is a list of what each return value signifies.
paragraphView:CaretRelativeToVisibleRect( visibleBox )
Return Value Meaning
---------------------------------------------------
'inbox
The caret is positioned inside the visible region.
'top
The caret is above the visible region.
'bottom
The caret is below the visible region.
'left
The caret is to the left of the visible region.
'right
The caret is to the right of the visible region.
nil
The view has no caret.