WireLess Studio Widgets Developer's Guide
WSWDG ContentsWStWidget class reference

ChangeMenuType

This method changes current menu type on a WS_MENU widget.

Ole declaration

VARIANT_BOOL ChangeMenuTypeByName(LPCTSTR sObjectName, SHORT usType);

VARIANT_BOOL ChangeMenuTypeById(SHORT usObjectId, SHORT usType);

Parameters
sObjectName
The name of the target widget.
usObjectId
The id of the target widget.
usType
The new menu type, this parameter can be one of the following:
Return Value

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

Remarks

The default menu type is WS_BUTTON_MENU_TYPE.

Changes on the menu type are effective only before the serialization of the parent form, once the form is transferred to the mobile unit the menu type can't be modified. But, If the menu is attached to more than one form, it's type may be different on each form.

The menu types can be found on the WSTWidgetConstants enumeration.

Example
C#
using WirelessStudioOleWidgets;
WStWidget oWidget = new WStWidget();
WStFactory oFactory = new WStFactory();
short iMenuId = 15;
oFactory .CreateWidgetById((short)WSTFactoryConstants.WS_MENU, iMenuId,"", 0,0, 50, 50, "");
oWidget.ChangeMenuTypeById(iMenuId, (short)WSTWidgetConstants.WS_COMBO_BOX_MENU_TYPE);
oWidget.AddOption(iMenuId, 0, "Show Menu");
oWidget.AddOption(iMenuId, 0, "Save File");
oWidget.AddOption(iMenuId, 0, "Close Application");
Visual Basic 6 (Full Example: MenuDemoModule.bas.txt)
Public wsWidget As New WStWidget
Public wsFactory As New WStFactory		
...
wsWidget.ChangeMenuTypeByName "listBoxMenu", WS_LIST_BOX_MENU_TYPE
wsWidget.ChangeMenuTypeByName "comboBoxMenu", WS_COMBO_BOX_MENU_TYPE
...
See also

ClearOptions | AddOption | GetOption | GetSelectedItem

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