Menu - Kirix Documentation

Developer Resources

Menu

Overview

The Menu class represents a menu, which is a vertical list of menu items.

Constructor

Menu()
Menu(title : String)

Arguments

title
The title of the menu.

Methods

Menu.add
Adds a menu or a menu item to a menu.
Menu.addSeparator
Adds a separator to a menu.
Menu.findMenuItem
Finds the location of a submenu or menu item in the menu.
Menu.getLabel
Returns the text of the menu.
Menu.getMenuItem
Returns a menu or menu item that is in the menu.
Menu.getMenuItemCount
Returns the number of menu items in the menu.
Menu.insert
Inserts a menu or menu item into a menu.
Menu.insertSeparator(index : Integer)
Inserts a separator into a menu.
Menu.popup
Creates a menu at a given position on a form.
Menu.remove
Removes a Menu or MenuItem from the menu.
Menu.setEnabled
Enables or disables a menu.
Menu.setLabel
Sets the label for a menu.

Menu.add

function Menu.add(item : Menu)
function Menu.add(item : MenuItem)

Arguments

item
The menu or menu item to add to the menu.

Description

Adds a menu or menu item specified by item to the menu.

Menu.addSeparator

function Menu.addSeparator()

Description

Adds a separator to the menu.

Menu.findMenuItem

function Menu.findMenuItem(caption : String) : Integer

Arguments

caption
The text of the submenu or menu item to find.

Returns

The zero-based index of the submenu or menu item with a particular caption or -1 if a submenu or menu item with a caption does not exist.

Description

Finds the location of a submenu or menu item with a particular caption in the menu and returns the location where the submenu or menu item is located. If a submenu or menu item with the caption is not found, then the function returns -1.

Menu.getLabel

function Menu.getLabel() : String

Returns

The text of the menu.

Description

Returns the text of the menu.

Menu.getMenuItem

function Menu.getMenuItem(index : Integer) : MenuItem
function Menu.getMenuItem(index : Integer) : Menu

Returns

The menu or menu item at the specified zero-based index in the menu. If index is less than 0, greater than the number of menu items in the menu or is unspecified, the function returns null.

Description

Returns the submenu or menu item at the specified index.

Menu.getMenuItemCount

function Menu.getMenuItemCount() : Integer

Returns

The number of submenus and menu items in the menu.

Description

Returns the number of submenus and menu items in the menu.

Menu.insert

function Menu.insert(item : Menu, index : Integer)
function Menu.insert(item : MenuItem, index : Integer)

Arguments

item
The menu or menu item to insert into the menu.
index
The location where item is inserted.

Description

Inserts a menu or menu item specified by item into the menu at a given index. If no index is specified, the menu or menu item is inserted at the end of the menu.

Menu.insertSeparator(index : Integer)

function Menu.insert(item : Menu, index : Integer)
function Menu.insert(item : MenuItem, index : Integer)

Arguments

index
The location where the separator is inserted.

Description

Inserts a separator into the menu at a given index. If no index is specified, the separator is inserted at the end of the menu.

Menu.popup

function Menu.popup(form : Form, point : Point)

Arguments

form
The Form object on which the menu is created.
point
The position where the menu is created.

Description

Creates a menu on a form at at a given point.

Menu.remove

function Menu.remove(index : Integer)
function Menu.remove(item : Menu)
function Menu.remove(item : MenuItem)

Arguments

index
The location of the item to remove.
item
The menu or menu item to remove.

Description

Removes a menu or a menu item from the menu. If the input is an integer, then the item at the position specified by index is removed. If the input is a menu or menu item, then the item is removed from the menu, wherever it is located.

Menu.setEnabled

function Menu.setEnabled()
function Menu.setEnabled(enabled : Boolean)

Arguments

enabled
A flag which determines whether a menu is enabled or not.

Description

Enables or disables a menu. If enabled isn't specified, the menu is enabled; otherwise the menu is enabled if enabled is true and disabled if enabled is false.

Menu.setLabel

function Menu.setLabel(label : String)

Arguments

label
The new next for the menu.

Description

Sets the menu text specified by label.