WireLess Studio Widgets Developer's Guide
WSWDG ContentsWStWidget class reference

SetSize

Call this method to change the dimensions of a specific widget.

Ole declaration

VARIANT_BOOL SetSizeByName(LPCTSTR sObjectName, SHORT usWidth, SHORT usHeight);

VARIANT_BOOL SetSizeById(SHORT usObjectId, SHORT usWidth, SHORT usHeight);

Parameters
sObjectName
The name of the target widget.
usObjectId
The id of the target widget.
usWidth
Specifies the new width of the widget.
usHeight
Specifies the new height of the widget.
Return Value

On success, SetSize returns TRUE, FALSE otherwise. To get extended information, call WStError::GetLastErrorCode.

Remarks

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

Example
C#
using WirelessStudioOleWidgets;
WStWidget oWidget = new WStWidget();
WStFactory oFactory = new WStFactory();
short iFieldId = 10;
oFactory.CreateWidgetById((short)WSTFactoryConstants.WS_FIELD, iFieldId, "", 0,0, 50, 50, "");
oWidget.SetSizeById(iFieldId, 30, 30);
Visual Basic 6 (Full Example: BasicPropertiesDemoModule.bas.txt)
Public wsWidget As New WStWidget
...
Public Sub ChangeSize(iSelectedOption As Integer)
    Dim iWidth As Integer
    Dim iHeight As Integer
    
    Select Case iSelectedOption
        Case 0
            iWidth = 30
            iHeight = 5
        Case 1
            iWidth = 42
            iHeight = 12
        Case 2
            iWidth = 15
            iHeight = 12
        Case -1
            iWidth = 42
            iHeight = 12
    End Select
            
    wsWidget.SetSizeByName "button", iWidth, iHeight
    wsWidget.SetSizeByName "label", iWidth, iHeight
    wsWidget.SetSizeByName "checkBox", iWidth, iHeight
    wsWidget.SetSizeByName "radioButton", iWidth, iHeight
    wsWidget.SetSizeByName "progBar", iWidth, iHeight
    wsWidget.SetSizeByName "field", iWidth, iHeight
    wsWidget.SetSizeByName "listBox", iWidth, iHeight
    wsWidget.SetSizeByName "comboBox", iWidth, iHeight + 2
    
End Sub
See also

GetWidth | GetHeight | SetPosition | GetXCoord | GetYCoord

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