[Up] [Previous] [Next] [Index]

# 7.4 Popups

- `PopupMenu(` name`,` labels`) O`

  creates a new popup menu and returns a GAP object describing it. name is the title of the menu and labels is a list of strings for the entries. Use `Query` to actually put the popup on the screen.

- `Query`

  actually puts a popup on screen. `Query` returns the string of the selected entry or `false` if the user clicks outside the popup. See also `Query` for dialogs in Query.

- `TextSelector(` name`,` list`,` buttons`) O`

  creates a new text selector and returns a GAP object describing it. name is a title. list is an alternating list of strings and functions. The strings are displayed and can be selected by the user. If this happens the corresponding function is called with two parameters. The first is the text selector object itself, the second the string that is selected. A selected string is highlighted and all other strings are reset at the same time. Use `Reset` to reset all entries.

  buttons is an analogous list for the buttons that are displayed at the bottom of the text selector. The text selector is displayed immediately and stays on screen until it is closed (use the `Close` operation). Buttons can be enabled and disabled by the `Enable` operation and the string of a text can be changed via `Relabel`.

- `Enable(` sel`,`bt`,`flag`)`
- `Enable(` sel`,`btindex`,`flag`)`

  Enables or disables the button bt (string value) or btindex (integer index) of the text selector sel, according to flag.

- `Relabel(` sel`,` list`)`
- `Relabel(` sel`,` index`,` text`)`

  Changes the strings that are displayed in the text selector. In the first form list must be a list of strings. The second form only changes the text at index index.

- `SetName(` sel`,` index`,` string`)`

  Every string in a text selector has a name. The names are stored in the list `names` component of the text selector. So `sel!.names` ist a list containing the names. The names are initialized with the strings from the creation of the text selector.

- `Reset(` sel`)`

  Resets all strings of a text selector, such that they are no longer selected.

- `Close(` sel`)`

  Closes a text selector. It vanishes from screen.

  Note that you have access to the indices and names of strings and buttons:

- `IndexOfSelectedText`

  Whenever the user clicks on a text in a text selector, the global variable is set to the index of the text in the text selector.

- `IndexOfSelectedButton`

  Whenever the user clicks on a button in a text selector, the global variable is set to the index of the button in the text selector.

  [Up] [Previous] [Next] [Index]