SetViewPort

This form method lets you decide which part of a form is visible.

Usage

frmForm.SetViewPort( nNewViewPortLeft, nNewViewPortTop )
In a form with scrollbars, only a portion of the form is visible at any time. The ViewPortLeft and ViewPortTop properties indicate what portion it is. This method sets those properties (which are read-only). If the values you pass are too big, the form scrolls as far to the right or the bottom as possible. "Too big" here means that listening to you would result in showing an area beyond the form's boundaries. The key point is that you can't assume that ViewPortLeft and ViewPortTop always contain the values you passed, even before the user gets an opportunity to scroll.

This method accepts negative parameters. It shouldn't, since the form begins at 0,0. It scrolls the appropriate amount, revealing empty negative space. At least some of the time, the refresh from such a call is incomplete and, in some cases, clicking on the form moves things back to where they were. All in all, an ugly mess. Don't do this!


Example

* Force the user to look at the upper-left corner
ThisForm.SetViewPort(0,0)

See Also

Form, ViewPortLeft, ViewPortTop


Back to Table of Contents

Copyright © 2002-2018 by Tamar E. Granor, Ted Roche, Doug Hennig, and Della Martin. Click for license .