- User Interface
- Status Bar
- Game Link
- Export Data
- Built-in Scripts
- API Reference
- Standard Library
- Interface Toolkit
- Technical Reference
This helper class adds support for a text-based menu system.
var menu = UITextMenu();
Create an instance of the
UITextMenu class. During construction the number of display columns will be stored, so make sure to set the correct display mode prior to calling.
The menu class has a public array member variable called
Menus which holds the structure of the menu system. The array is expected to hold table objects with the following slots:
||The display name of the menu. Use the & prefix on one character to specify the shortcut key for keyboard mode.|
||This optional flag allows the last menu to be right-aligned on the menu bar. Note that only last item in the Menus array can have this flag set.|
||An array of options for the menu. Note that nested sub-menus are not supported.|
options array should contain a list of tables with the following slots:
||The display name of the menu option. Use the & prefix on one character to specify the shortcut key for keyboard navigation mode.|
||Optional shortcut text to be display right-aligned on the menu. Note the user code is responsible for processing shortcuts, this is a display feature only.|
||This optional flag changes the menu option into a separating line in the menu. Use this to group related menu options. When this mode is used, all other fields in the option table are ignored.|
||This optional field allows for menu options to be disabled. Disabled options will not register as a selection.|
||This optional field, when set true, will draw a check-mark next to the option.|
Note that other user-defined fields may be added to the option to assist with decoding selected options by assigning a unique identifier.
This is the primary function that handles running the menu system. It returns
true if the menu is open or in keyboard navigation mode or a selection is available.
It is recommended that the
Acquires the last menu selection, or
null if no selection has been made. Note that after a selection has been reported, the internal value is cleared and subsequent calls to this function will return null until a new selection is made.
The selection table contains the following slots:
||The index of the selected menu in the Menus array.|
||The index in the menu options array (dividers are included).|
||A reference to the array element in the menu that was selected (for easy access to any additional user-data.)|
true if the menu is open, or in keyboard navigation mode. Input based application processing should be suspended while the menu is open.
Forces the menu to redraw itself.