WireLess Studio Widgets Developer's Guide
WSWDG ContentsWStWidget class reference

SetPosition

This method changes the position of a specific widget. The position is relative to the upper-left corner of the screen.

Ole declaration

VARIANT_BOOL SetPositionByName(LPCTSTR sObjectName, SHORT usXCoord, SHORT usYCoord);

VARIANT_BOOL SetPositionById(SHORT usObjectId, SHORT usXCoord, SHORT usYCoord);

Parameters
sObjectName
The name of the target widget.
usObjectId
The id of the target widget.
usXCoord
Specifies the new position of the left side of the widget.
usYCoord
Specifies the new position of the top of the widget.
Return Value

SetPosition returns TRUE if the position of the widget could be changed, FALSE otherwise. To get extended information, call WStError::GetLastErrorCode.

Remarks

The widget's position depends on the coordinates type used by parent form. (For more information see SetCoordType).

Example
C#
using WirelessStudioOleWidgets;
WStWidget oWidget = new WStWidget();
WStFactory oFactory = new WStFactory();
short iBitmapId = 10;
oFactory.CreateWidgetById((short)WSTFactoryConstants.WS_BITMAP, iBitmapId , "", 0,0, 50, 50, "");
oWidget.SetPositionById(iBitmapId, 10, 50);	
Visual Basic 6 (Full Example: BasicPropertiesDemoModule.bas.txt)
Public wsWidget As New WStWidget
...
Public Sub ChangePosition(iXOffset As Integer, iYOffset As Integer)
    
    wsWidget.SetPositionByName "topLine", wsWidget.GetXCoordByName("topLine") + iXOffset, _
        wsWidget.GetYCoordByName("topLine") + iYOffset
    wsWidget.SetPositionByName "button", wsWidget.GetXCoordByName("button") + iXOffset, _
        wsWidget.GetYCoordByName("button") + iYOffset
...
End Sub
See also

GetXCoord | GetYCoord | SetSize | GetWidth | GetHeight

WStWiget class reference | WStForm class reference | WStFactory class reference | WStError class reference