[Up] [Next] [Index]

# 7.1 Menus in Graphic Sheets

- `Menu(` sheet`,` title`,` ents`,` fncs`) O`
- `Menu(` sheet`,` title`,` zipped`) O`

  `Menu` returns a pulldown menu. It is attached to the sheet sheet under the title title. In the first form ents is a list of strings consisting of the names of the menu entries. fncs is a list of functions. They are called when the corresponding menu entry is selected by the user. The parameters they get are the graphic sheet as first parameter, the menu object as second, and the name of the selected entry as third parameter. In the second form the entry names and functions are all in one list zipped in alternating order, meaning first a menu entry, then the corresponding function and so on. Note that you can delete menus but it is not possible to modify them, once they are attached to the sheet. If a name of a menu entry begins with a minus sign or the list entry in ents is not bound, a dummy menu entry is generated, which can sort the menu entries within a menu in blocks. The corresponding function does not matter.

- `Check(` menu`,` entry`,` flag`) O`

  Modifies the ``checked'' state of a menu entry. This is visualized by a small check mark behind the menu entry. menu must be a menu object, entry the string exactly as in the definition of the menu, and flag a boolean value.

- `Enable(` menu`,` entry`,` flag`) O`
- `Enable(` menu`,` boollist`) O`

  Modifies the ``enabled'' state of a menu entries. Only enabled menu entries can be selected by the user. Disabled menu entries are visualized by grey or shaded letters in the menu. menu must be a menu object, entry the string exactly as in the definition of the menu, and flag a boolean value. entry can also be a natural number meaning the index of the corresponding menu entry. In the second form boollist must be a list where each entry has either a boolean value or the value `fail` The list must be as long as the number of menu entries in the menu menu. All menu entries where a boolean value is provided are enabled or disabled according to this value.

  See the explanation of `GraphicSheet` (Close!Callback) for the ``Close'' event, which occurs when the user selects the menu entry `close graphic sheet` in the `Sheet` menu.

  [Up] [Next] [Index]