moduleAddMenu()

Adds a new menu to Script Editor or GEDI module.

Synopsis

int moduleAddMenu( string label[, int idx]);

Parameters

Parameter Description
label The label of the menu
idx Optional. The index defines the position of the menu. The index starts with 0 (first menu).

Return value

The function returns the ID of the menu.

Error

Missing or invalid arguments.

Description

Adds a new menu to the Script Editor or GEDImodule.

If the menu shall be added to the GEDI, the script should be located in <project_directory>/scripts/gedi and must be called <name>_ext.ctl. When the GEDI is started, all scripts from this directory will be loaded.

If the menu shall be added to the Script Editor, the script should be located in <project_directory>/scripts/scriptEditor and must be called <name>_ext.ctl. When the Script Editor is started, all scripts from this directory will be loaded.

If you want to create a menu with the same description a second time, the ID already existing will be returned. In this way, several entries with different <name>_ext.ctl scripts can be created.

The function moduleAddDockModule() isn't supported by the Script Editor menu.

Example

The following example adds the menu "Main" and the sub menu "Sub" to the GEDI module. The ID of the created menu "Main" will be used when creating the sub menu "Sub". The ID is the return value of the "moduleAddMenu" function.

main()

{

string men = "Main";

int i = moduleAddMenu(men,3); /* adds the menu "Main" to GEDI when located in

/Scripts/Gedi and the menu to VISION when opened in VISION module */

DebugN("ID of the new menu",i);

string lab = "Sub";

moduleAddSubMenu(lab, i);

}

Assignment

Miscellaneous functions

Availability

UI

See also

moduleAddAction(), moduleAddDockModule(), moduleAddSubMenu(), moduleAddToolBar()