You are here: Core Reference > Coding > Scripting > Menu.Display

Menu.Display

NOTE: The Menu.Display function is not intended for use with global variables. (If the Menu.Display function is assigned to a global variable, no menu will be displayed and the Menu.Display function will return 0.)

The Menu.Display function is intended for use in conjunction with a database item's pick action. It allows the script to display a menu. The Menu.Display function has to be used at the end of the menu definition (after Menu.Init, Menu.AddItem, Menu.AddMenu, and so on).

Syntax

Menu.Display()

Description

Displays a Menu.

Arguments

None

Returns

The index number of the selected option.

Each menu option has an index number. The menu options are indexed in top to bottom order. This means that the first menu option has index number 1, the second index number 2 and so on. If there are submenus, the options in the submenus are treated as if they are top level menu options.

For the menu shown below, the options are numbered as follows:

The submenu does not have an index number. Similarly, the separator also does not have an index number.

The Menu.Display() function will return the index number of the menu option that is selected. If no menu option is selected, the Menu.Display function returns 0. You can then use the reference number when you define the functionality of the option in your script (using other functions such as the Server Functions).

Example:

Menu.Display()


ClearSCADA 2015 R2