WireLess Studio Widgets Developer's Guide
WSWDG ContentsWStWidget class reference

GetOption

This methods retrieves the text displayed by an option on a WS_MENU.

Ole declaration

BSTR GetOptionByName(LPCTSTR sObjectName, SHORT usOptionIndex);

BSTR GetOptionById(SHORT usObjectId, SHORT usOptionIndex);

Parameters
sObjectName
The name of the target widget.
usObjectId
The id of the target widget.
usOptionIndex
The zero based index of the target option.
Return Value

On success, GetOption returns the displayed by the target option. On error GetOption returns an empty string. To get extended information, call WStError::GetLastErrorCode.

Remarks
Example
C#
using WirelessStudioOleWidgets;
WStWidget oWidget = new WStWidget();
short iMenuId= 4;
oFactory.CreateWidgetById((short)WSTFactoryConstants.WS_MENU, iMenuId, "", 0,0, 50, 50, "");
oWidget.ChangeMenuTypeById(iMenuId, (short)WSTWidgetConstants.WS_COMBO_BOX_MENU_TYPE);
oWidget.AddOptionById(iMenuId, 0, "Show Menu");
oWidget.AddOptionById(iMenuId, 0, "Save File");
oWidget.AddOptionById(iMenuId, 0, "Close Application");
string sOption = oWidget.GetOptionById(iMenuId, 2);
Visual Basic 6 (Full Example: MenuDemoModule.bas.txt)
Public wsWidget As New WStWidget
...
Case "listBoxMenu"
	wsWidget.SetTextByName "optionSelected", "ListBoxMenu ( " + _
	wsWidget.GetOptionByName("listBoxMenu", iIntValue) + " )"
Case "buttonMenu"
	wsWidget.SetTextByName "optionSelected", "ButtonMenu ( " + _
	wsWidget.GetOptionByName("buttonMenu", iIntValue) + " )"
Case "comboBoxMenu"
	wsWidget.SetTextByName "optionSelected", "ComboBoxMenu ( " + _
	wsWidget.GetOptionByName("comboBoxMenu", iIntValue) + " )"
...
See also

AddOption | GetOption | ChangeMenuType | ClearOptions

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