MenuItem class | menusys.t[275], menucon.t[44], menuweb.t[16]

A MenuItem is a given item in the menu tree. In general all you need to do to use menus is create a tree of MenuItems with titles.

To display a menu tree, call displayMenu() on the top menu in the tree. That routine displays the menu and processes user input until the user dismisses the menu, automatically displaying submenus as necessary.

Modified in menucon.t[44]:
Menu Item - user interface implementation for the console

Modified in menuweb.t[16]:
Menu Item - user interface implementation for the console

`class MenuItem : MenuObject`

Superclass Tree (in declaration order)

`MenuItem`
`MenuObject`
`object`

Subclass Tree

`MenuItem`
`HintMenu`
`TopHintMenu`
`MenuLongTopicItem`
`HintLongTopicItem`
`MenuTopicItem`
`Goal`

Global Objects

(none)

Summary of Properties

`bgcolor curKeyList curMenu fgcolor fullScreenMode heading indent isOpen keyList prevMenuLink title topbarbg topbarfg topMenu`

Inherited from `MenuObject` :
`contents menuOrder`

Summary of Methods

`display enterSubMenu formatXML getChildIndex getKeysXML getNextMenu getPrevMenu getXML refreshTopMenuBanner removeStatusLine removeTopMenuBanner showMenu showMenuHtml showMenuText showTopMenuBanner updateContents`

Inherited from `MenuObject` :
`addToContents compareForMenuSort execute initializeContents initializeLocation`

Properties

`bgcolor` | `menusys.t[311]`

no description available

`curKeyList` | `menusys.t[354]`

the current key list - we'll set this on entry to the start of each showMenuXxx method, so that we keep track of the actual key list in use, as inherited from the top-level menu

`curMenu` | `menuweb.t[41]`

current menu, and current top-level menu

`fgcolor` | `menusys.t[310]`

foreground (text) and background colors, as HTML color names

`fullScreenMode` | `menusys.t[328]`

full-screen mode: make our menu take up the whole screen (apart from the instructions bar, of course)

`heading` | `menusys.t[283]`

the heading - this is shown when this menu is active; by default, we simply use the title

`indent` | `menusys.t[322]`

number of spaces to indent the menu's contents

`isOpen` | `menuweb.t[45]`

is the menu open?

`keyList` | `menusys.t[347]`

The keys used to navigate the menus, in order:

[quit, previous, up, down, select]

Since multiple keys can be used for the same navigation, the list is implemented as a List of Lists. Keys must be given as lower-case in order to match input, since we convert all input keys to lower-case before matching them.

In the sublist for each key, we use the first element as the key name we show in the instruction bar at the top of the screen.

By default, we use our parent menu's key list, if we have a parent; if we have no parent, we use the standard keys from the library messages.

`prevMenuLink` | `menusys.t[363]`

Title for the link to the previous menu, if any. If the menu has a parent menu, we'll display this link next to the menu title in the top instructions/title bar. If this is nil, we won't display a link at all. Note that this can contain an HTML fragment; for example, you could use an <IMG> tag to display an icon here.

`title` | `menusys.t[277]`

the name of the menu; this is listed in the parent menu

`topbarbg` | `menusys.t[319]`

no description available

`topbarfg` | `menusys.t[318]`

Foreground and background colors for the top instructions bar. By default, we use the color scheme of the parent menu, or the inverse of our main menu color scheme if we're the top menu.

`topMenu` | `menuweb.t[42]`

no description available

Methods

`display ( )` | `menucon.t[51], menuweb.t[23]`

Call menu.display when you're ready to show the menu. This should be called on the top-level menu; we run the entire menu display process, and return when the user exits from the menu tree.

Modified in menuweb.t[23]:
Call menu.display when you're ready to show the menu. This should be called on the top-level menu; we run the entire menu display process, and return when the user exits from the menu tree.

`enterSubMenu (idx)` | `menuweb.t[61]`

navigate into a submenu

`formatXML (func)` | `menuweb.t[146]`

Prepare a title or content string for our XML output. If 'val' is a string, we'll run it through the output formatter to expand any special <.xxx> sequences. If 'val' is a property, we'll evaluate the property of self, capturing the output if it generates any or capturing the string if it returns one. In all cases, we take the result string and convert TADS special characters to HTML, and finally html-escape the result for inclusion in XML output, and return the resulting string.

`getChildIndex (child)` | `menusys.t[409]`

get the index in the parent of the given child menu

`getKeysXML (buf)` | `menuweb.t[119]`

get the XML description of the top-level key list

`getNextMenu (menu)` | `menusys.t[379]`

Get the next menu in our list following the given menu. Returns nil if we don't find the given menu, or the given menu is the last menu.

`getPrevMenu (menu)` | `menusys.t[396]`

Get the menu previous tot he given menu. Returns nil if we don't find the given menu or the given menu is the first one.

`getXML (from)` | `menuweb.t[87]`

Package my menu items as XML, to send to the javascript API. 'from' is the menu we just navigated from, if any. This is nil when we enter the top level menu, since we're not navigating from another menu; when we navigate from a parent to a child, this is the parent; when we return from a child to a parent, this is the child; and when we move directly from sibling to sibling (via a next/previous chapter command), this is the sibling. When we display a new topic in a topic list menu, this is simply 'self'.

`refreshTopMenuBanner (topMenu)` | `menucon.t[486]`

Refresh the contents of the top bar with the instructions

`removeStatusLine ( )` | `menucon.t[557]`

Remove the status line banner prior to displaying the menu

`removeTopMenuBanner ( )` | `menucon.t[538]`

Remove the top banner window

`showMenu (from)` | `menuweb.t[48]`

show this menu as a submenu

`showMenuHtml (topMenu)` | `menucon.t[262]`

Show the menu using HTML. Return nil when the user selects QUIT to exit the menu entirely.

`showMenuText (topMenu)` | `menucon.t[129]`

Display the menu in plain text mode. This is used when the interpreter only supports the old tads2-style text-mode single-line status area.

Returns true if we should return to the parent menu, nil if the user selected QUIT to exit the menu system entirely.

`showTopMenuBanner (topMenu)` | `menucon.t[457]`

showTopMenuBanner creates the banner for the menu using the banner API. The banner contains the title of the menu on the left and the navigation keys on the right.

`updateContents ( )` | `menusys.t[371]`

Update our contents. By default, we'll do nothing; subclasses can override this to manage dynamic menus if desired. This is called just before the menu is displayed, each time it's displayed.

TADS 3 Library Manual
Generated on 5/16/2013 from TADS version 3.1.3