&<img src="../resources/images/opentocr.png" title="Open Contents list" border="0"&>
You are here:

Example 4: Collection of Menu Items

This example shows how to create a collection of menu items which correspond the the selected entries in a list view.

When an item is selected in the menu, it is deselected in the list view.
Define the Collection
In this example we are using a collection style collection to add menu items to the menu item collection. This is how the collection of the menu items is defined:
Define_Com Class(#PRIM_KCOL<#PRIM_MITM #EMPNO>) Name(#MENU_ITEMS) Collects(#PRIM_MITM) Keyedby(#EMPNO) Style(Collection)

Submenu
The submenu which will contain the menu items is defined, but it is not associated with the menu title yet because initially it contains no items and it is defined with a dynamic reference which means that the submenu will be created only when a reference is explicitly set to it:
DEFINE_COM class(#PRIM_SMNU) name(#Sub_menu) reference(*dynamic)
Add Items to the Collection
A menu item is added to the MENU_ITEMS collection when an employee in the list is selected:
 
Evtroutine Handling(#LTVW_1.ItemGotSelection) Options(*NOCLEARMESSAGES *NOCLEARERRORS)