Menu:
Filter:
Classes | GUI

Menu

Context and application-level menus
Location: NOT INSTALLED!

Description

The Menu class allows the creation and control of context menus and application-level menus.

Class Methods

.new

Create a new menu. A menu is populated with MenuActions

Arguments:

One or more MenuActions or Menus to be displayed in the menu. Menu arguments will create sub-menus.

Discussion:

Inherited class methods

Instance Methods

Control

.front

Show the menu if it is not already shown. Note that unlike most Views, Menus are not destroyed when they are closed - front can be used to re-generate a single menu again and again.

Arguments:

point

A Point at which to show the menu. Default to the current mouse cursor position.

action

The action that should appear at the specified point coordinates. Should be an action contained in the menu.

.title

The title of the menu.

Arguments:

title

A String.

.tearOff

Arguments:

If true, menu is / will be torn off from its parent and become a free-floating menu.

.copy

Create an identical copy of the menu. The new menu will not be shown until .front is called.

Events

Menus broadcast several kinds of events that can be registered for with the standard Object: -addDependant calls. Events broadcast by menu:

Events example

Context Menus

One or more MenuActions can be attached to any View object. The shortcut key combinations for these actions will become available, and the actions will appear in the context menu for that view.

See View: -setContextMenuActions, View: -addMenuAction, View: -removeMenuAction for more information.

Inherited instance methods

Examples

A more complex menu.