Omnis Technical Note TNGI0001

Cascaded Menu Instances

For Omnis Studio version 1.1 and later
By Bob Mitchell

How to manage instances of cascaded menus

Contents

Instance Creation
Instance Access


Instance Creation

When Omnis creates a new menu instance, it also needs to obtain instances for any menu line objects for which the $cascade property is set.

Suppose you have a menu MENU1, with a menu line object MENU1_CASCADE, which has its $cascade property set to CASCADE.

When you instantiate MENU1, if there is already an instance of CASCADE with the default name CASCADE, the new instance of MENU1 will use the existing instance of CASCADE.

In other words, the default behaviour is that cascaded menus with the same class use a single instance.

Note that the existing instance need not itself be a cascaded menu. For example, if CASCADE is already installed on the main menu bar, and you instantiate MENU1, the new instance of MENU1 will use the instance of CASCADE on the main menu bar.

Of course, this behaviour may not be to your liking. You can force a new instance to be created for every cascaded menu, by setting the $cascade property to CASCADE/*.


Instance Access

Once you have a menu which has a cascaded menu instance, how do you access it? $menuinst is a property of a menu instance line object, which is a reference to the cascaded menu instance.

Download RTF Document