ViewPortLeft, ViewPortTop

These two properties tell you what part of a form is currently visible. Well, actually, they tell you where the visible part starts—you need to combine them with some others to figure out the whole visible portion.

Usage

nVisibleLeft = frmForm.ViewPortLeft
nVisibleTop = frmForm.ViewPortTop
For a form with scrollbars, you sometimes need to know which part of the form the user can see at this moment. These two get you started by telling you the upper-left corner of the part you can see. Add Height and Width to these to see where the visible area ends.You can't set these directly. To change the position of the viewport, call the SetViewPort method.

Example

* A control can figure out whether it can be seen
IF NOT BETWEEN(This.Left,ThisForm.ViewPortLeft, ;
               ThisForm.ViewPortLeft + ThisForm.Width)
   * Hmmm, I can't be seen. What should I do?
   * I know. I'll be obnoxious!
   MESSAGEBOX("Hey, you can't see me! Try scrolling.", 64, ;
              This.Name)
ENDIF

See Also

Form, Height, SetViewPort, ViewPortHeight, ViewPortWidth, Width


Back to Table of Contents

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