Menu functions can be used to access the contents defined in the Menu Configuration database at runtime.
Base Menu Tree
After your project is compiled, menu configurations defined in your project and the included project are merged into a single menu structure. The menu tree is configured according to the different pages specified for your menu items. The menu tree is sorted according to the order field defined in the menu configuration records. At runtime, the structure of the menu tree is as follows:
root node
L___<page node for generic pages>
| L___<Level 1 items>...
| L___<Level 2 items>...
| L___<Level 3 items>...
| L___<Level 4 items>...
L___<page node for specific page>
| L___<Level 1 items>...
| L___<Level 2 items>...
| L___<Level 3 items>...
| L___<Level 4 items>...
L___<page node for specific page>
The above menu tree represents a static view of the overall menu structure defined in your project. You can access a particular branch of the menu tree by the name of the page that the menu configuration belongs to.
To access the menu tree that is available for all pages (that is, generic pages), call Cicode function MenuGetGenericNode to get its node handle. You can browse its descendent child nodes using Cicode functions: MenuGetFirstChild, MenuGetNextChild and MenuGetPrevChild etc.
To access the menu tree that is specific for a particular page, call Cicode function MenuGetPageNode to get its node handle. Similarly, you can use the menu browse functions to walk through the tree.
Dynamic Menu Tree
When a new page is displayed, an instance of the menu tree that merges the menu items for the generic pages and the menu items specified for the page will be automatically created. Under the merged tree, the level that represents different pages will no longer exist. The structure of the menu tree looks as follows:
root node
L___<Level 1 item>...
| L___<Level 2 items>...
| L___<Level 3 items>...
| L___<Level 4 items>...
L___<Level 1 items>...
To access to the instance of the menu tree for a particular window, call Cicode function MenuGetWindowNode to get the handle of the root node. Similarly, you can use the same set of menu browse functions as above to walk through the tree.
See Also