WireLess Studio Widgets Developer's Guide
WSWDG ContentsWStWidget class reference

SetText

This method changes the text displayed by a widget.

Ole declaration

VARIANT_BOOL SetTextByName(LPCTSTR sObjectName, LPCTSTR sText);

VARIANT_BOOL SetTextById(SHORT usObjectId, LPCTSTR sText);

Parameters
sObjectName
The name of the target widget.
usObjectId
The id of the target widget.
sText
The new text that will be displayed by the target widget.
Return Value

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

Remarks

Although this method has no effect on some widgets e.g.: WS_BITMAP, WS_LIST_CTRL, etc. The text is saved by the widget and can be retrieved later.

Example
C#
using WirelessStudioOleWidgets;
WStWidget oWidget = new WStWidget();
WStFactory oFactory = new WStFactory();
short iButtonId = 44;
oFactory.CreateWidgetById((short)WSTFactoryConstants.WS_BUTTON, sButtonId, "", 0,0, 50, 50, "");
string sMessage =  string.Format("{0:00}",33);
oWidget.SetText(iButtonId, sMessage);	
Visual Basic 6 (Full Example: CheckBoxDemoModule.bas.txt)
Public wsWidget As New WStWidget
...
'Shows initial state of the checkBoxes
   sState = wsWidget.GetStateByName("checkBox")
   sCurrentState = "CheckBox: " + sState
   
   sState = wsWidget.GetStateByName("checkBox4")
   sCurrentState = sCurrentState + "  " + "CheckBox4: " + sState
   
   wsWidget.SetTextByName "firstLineState", sCurrentState
...
See also

GetText | SetFont | SetTextColor | SetBackgroundColor

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