loadSubMenu(index: Integer): MenuItem;
The loadSubMenu method of the MenuItem class enables an existing submenu item to be "cloned" at run time; that is, one or more copies of that submenu item can be created at run time in the submenu of the form as subitems of that menu item.
The cloned submenu can be a submenu item created at run time (to control ordering) or it can be one created in JADE Painter.
The submenu item is added to the end of existing subitems of the menu that is being cloned or as the first subitem if that menu did not previously have any subitems. New clone submenu items are created using the runtime copy of the submenu item.
Each submenu item calls the same methods defined for the original submenu item, passing their own submenu item object as the first parameter. In addition, you must assign a unique identifier to each submenu item, which is passed to the loadSubMenu method in the index parameter.
Submenu items that are created in the JADE Painter have an index parameter value of zero (0).
Most commonly, the value of the index parameter would be just that: an index. The values need not be sequential, but they cannot be duplicated.
An exception is raised if a MenuItem method is invoked from a server method.
The code fragment in the following example shows the creation of a new submenu item.
submenu := myTestSubmenu.loadSubMenu(count);
In this example, the myTestSubmenu value is the submenu item that is being cloned, the submenu value is the new copy of the submenu item created, and the count value is the unique copy index supplied by the caller.
Any submenu item that is added is automatically deleted when the form is destroyed. You can also delete these submenu items dynamically, by using the