Problem: How To Move and Resize Controls at Runtime
Solution: Starting with Satellite Forms 7.0, new control methods are provided to move and resize form controls at runtime. This capability is implemented for the PalmOS and PocketPC platforms, and complements the PalmOS Dynamic Input Area support that is also new with SatForms 7.0.
The .GetPosition method retrieves the current top left X and Y coordinates, width, and height of the specified control.
GetPosition
Controls(ControlName).GetPosition(cX, cY, cW, cH) |
||
Returns the current position (cX, cY) and size (cW, cH) of a control. |
||
Parameters |
ControlName |
Name of a control. |
cX |
On return, contains the top left X coordinate of the control. |
|
cY |
On return, contains the top left Y coordinate of the control. |
|
cW |
On return, contains the width of the control. |
|
cH |
On return, contains the height of the control. |
|
Return Value |
None, the location and size values are returned in the cW, cY, cW, and cH parameter variables. |
|
Comments |
GetPosition is a method of the Control object. This method is useful when combined with the new Dynamic Input Area support that enables you to move and resize controls on a form in response to changes in the form size or orientation. |
|
Example |
'example of control GetPosition and SetPosition methods Dim cX, cY, cW, cH 'obtain the current location and size of Button1 Button1.GetPosition(cX, cY, cW, cH) 'move Button1 control down 10 pixels, right 10 pixels, widen by 5 pixels, increase height by 5 pixels Button1.SetPosition(cX+10, cY+10, cW+5, cH+5) |
|
See Also |
SetPosition |
The .SetPosition method enables you to modify the current top left X and Y coordinates, width, and height of the specified control. This method allows you to both move and resize a control on the form.
SetPosition
Controls(ControlName).SetPosition(cX, cY, cW, cH) |
||
Modifies the current position (cX, cY) and size (cW, cH) of a control. |
||
Parameters |
ControlName |
Name of a control. |
cX |
The new top left X coordinate of the control. |
|
cY |
The new top left Y coordinate of the control. |
|
cW |
The new width of the control. |
|
cH |
The new height of the control. |
|
Return Value |
None. |
|
Comments |
SetPosition is a method of the Control object. This method is useful when combined with the new Dynamic Input Area support that enables you to move and resize controls on a form in response to changes in the form size or orientation. |
|
Example |
'example of control GetPosition and SetPosition methods Dim cX, cY, cW, cH 'obtain the current location and size of Button1 Button1.GetPosition(cX, cY, cW, cH) 'move Button1 control down 10 pixels, right 10 pixels, widen by 5 pixels, increase height by 5 pixels Button1.SetPosition(cX+10, cY+10, cW+5, cH+5) |
|
See Also |
GetPosition |
Keywords: move, resize, control, width, height, size, location, coordinate
KB ID: 10037
Updated: 2006-10-02
Satellite Forms KnowledgeBase Online