WireLess Studio Widgets Developer's Guide
WSWDG ContentsWStWidget class reference

DisplayBatteryLifePercent

This methods enables or disables the display of the current battery life percent on a WS_LABEL widget.

Ole declaration

VARIANT_BOOL DisplayBatteryLifePercentByName(LPCTSTR sObjectName, VARIANT_BOOL bDisplay);

VARIANT_BOOL DisplayBatteryLifePercentById(SHORT usObjectId, VARIANT_BOOL bDisplay);

Parameters
sObjectName
The name of the target widget.
usObjectId
The id of the target widget.
bDisplay
Specifies if the current battery life percent will be displayed or not.
Return Value

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

Remarks

The battery life percent is shown using the following format : "s: dd%", where s is the string currently being displayed by the widget and d is a digit.

Example
C#
using WirelessStudioOleWidgets;
WStWidget oWidget = new WStWidget();
short iLabelId = 31;
oFactory.CreateWidgetById((short)WSTFactoryConstants.WS_LABEL, iLabelId, "", 0,0, 50, 50, "");
oWidget.DisplayBatteryLifePercent(iLabelId, TRUE);
Visual Basic 6 (Full Example: LabelDemoModule.bas.txt)
Public wsWidget As New WStWidget
...
'label Test 7: Current Battery life percent display
wsWidget.DisplayBatteryLifePercentByName "labelTest7", True
wsWidget.SetBackGroundColorByName "labelTest7", 167, 236, 171
...
See also

DisplayCurrentTime | Enable | ShowBorder

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