WireLess Studio Widgets Developer's Guide |
Call this method to add a new option to a specific WS_MENU widget.
VARIANT_BOOL AddOptionByName(LPCTSTR sObjectName, SHORT usIconId, LPCTSTR sOptionText);
VARIANT_BOOL AddOptionById(SHORT usObjectId, SHORT usIconId, LPCTSTR sOptionText);
On success, AddOption returns TRUE, FALSE otherwise. To get extended information, call WStError::GetLastErrorCode.
The icon's id is omitted if the target menu's type is not WS_BUTTON_MENU_TYPE. The number of options that can be displayed by a button menu depends on it's size, if certain number of options is exceeded, no options are displayed ( Try MenuDemoModule.bas.txt using 30 or more options).
AddOption always loads the 32x32 pixel version of the selected icon.
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.AddOptionById(iMenuId, 0, "Show Menu"); oWidget.AddOptionById(iMenuId, 0, "Save File"); oWidget.AddOptionById(iMenuId, 0, "Close Application");
Public wsWidget As New WStWidget Public wsFactory As New WStFactory ... Public Sub FillOptions(sMenuName As String, iOptionCount As Integer) Dim i As Integer Dim iIconIndex As Integer Dim sOptionIndex As String wsWidget.ClearOptionsByName sMenuName If iOptionCount < 1 Then Exit Sub End If iIconIndex = 1 For i = 1 To iOptionCount sOptionIndex = i wsWidget.AddOptionByName sMenuName, iIconIndex, "Option " + sOptionIndex iIconIndex = Int((4 - 1 + 1) * Rnd + 1) Next i End Sub ...
GetOption | GetSelectedItem | ChangeMenuType | ClearOptions | EnableFlatStyle
WStWiget class reference | WStForm class reference | WStFactory class reference | WStError class reference
WireLess Studio by SofToGo S.A. | Visit our site www.softogo.com | Contact us help@softogo.com |