| Parameter | Description |
|---|---|
| aMenu (ByRef) | tWebMenuItem array |
Procedure OnDefineMenu tWebMenuItem[] ByRef aMenu
This event can be implemented to dynamically define a menu structure.
To define a menu structure, the tWebMenuItem array should be filled with items representing menu items. The entire menu should be defined at once and submenus can be placed in the aChildren array of tWebMenuItem. OnDefineMenu is called when the menu object is loaded on the client and when FullRefresh is called. If the dynamic menu items are clicked, the OnItemClick event fires in the object that defined the items.
Object oWebMenuButton is a cWebMenuButton
Set psCaption to "Menu"
Set pbMenuShowCaption to False
Procedure OnDefineMenu tWebMenuItem[] ByRef aMenu
Move "1" to aMenu[0].sId
Move "Item 1" to aMenu[0].sCaption
Move True to aMenu[0].bEnabled
Move "2" to aMenu[1].sId
Move "Item 2" to aMenu[1].sCaption
Move True to aMenu[1].bEnabled
Move "2.1" to aMenu[1].aChildren[0].sId
Move "Item 2.1" to aMenu[1].aChildren[0].sCaption
Move True to aMenu[1].aChildren[0].bEnabled
End_Procedure
Procedure OnItemClick String sId String sCaption
Send ShowInfoBox (SFormat("Dynamic menu item '%1' was clicked!", sCaption))
End_Procedure
End_Object
When using OnDefineMenu with a cWebMenuItemCheckbox, pbChecked is unavailable and thus the checked states need to be manually synced using UpdateItem.