Dragging a View Based on ProtoTXView

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: Dragging a View Based on ProtoTXView (7/8/97)

Q: I have a protoTXView-based view as a descendent of a draggable view. When I drag the view, the protoTXView-based view still draws its contents at the original coordinates. What is going wrong?

A: The protoTXView prototype does not correctly update its draw origin coordinates when moved. To work around this bug, you must close the protoTXView-based view and re-open it.

Before closing the protoTXView-based view, you will need to externalize the data so that you can restore the data when you reopen the view. To do this, call the Externalize method and store the return value somewhere (perhaps in the parent of the protoTXView). When you reopen the view, call the Internalize method with the stored return value of the call to Externalize.

You will probably also want to save and restore the scroll coordinate, the caret offset, and the hilite range.