Moved

This event fires when an object is moved either by the user or in code.

Usage

PROCEDURE oObject.Moved
Calling the Move method fires this event, but only if the object actually moves. If you pass the current values of nLeft and nTop to Move, Moved doesn't fire. For a form, Moved also fires when the user moves the form and when the form is resized from the left or the top. That's right, pulling down the top of the form with the mouse fires Moved. That's because Moved fires whenever the value of Left or Top changes.In situations where both Moved and Resize are fired (like resizing from the top or left), Moved executes first.When you move columns around in a grid, Moved is called only for the column triggering the move, not for every column that changes position as a result.

Example

* In a formset, when one form is moved, you might move another 
* to make sure it's still visible. Put code like this in the 
* first form's Moved to keep the forms side by side.
* Of course, the user may not appreciate this, if he's trying
* to separate the forms.
nBorderWidth = SYSMETRIC(3)
IF This.Left + This.Width + ThisFormSet.form2.Width + ;
   4 * nBorderWidth <= _SCREEN.Width
   ThisFormSet.form2.Left = This.Left + This.Width + ;
     2 * nBorderWidth
ELSE
   ThisFormSet.form2.Left = ;
     This.Left - ThisFormSet.form2.Width - 2 * nBorderWidth
ENDIF
ThisFormSet.Form2.Top = This.Top

See Also

Left, Move, Resize, SysMetric(), Top


Back to Table of Contents

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