Class TextMenu
Class for displaying a SimConnect text menu and handling the result.
SimConnect maintains a queue of menus from all of its clients.
When the user closes the window without selecting an item, SimConnect doesn't emit any event, so you have to set a timeout if you want to handle this possibility.
When you call TextMenu:show, the object will be kept alive until a result is received.
Class TextMenu
Class TextMenu
- TextMenu.new(title, prompt, items, timeout, callback)
-
Constructor
Parameters:
- title string
- prompt string Can be an empty string
- items table Array of strings
- timeout int Timeout in seconds. 0 means infinite.
- callback
function
The function that's going to handle the menu events, with the following parameters:
The result: TextMenuResult.OK, TextMenuResult.Replaced, TextMenuResult.Timeout, TextMenuResult.Removed
The array index of the item
The item itself (string)
The menu
- TextMenu.new(title, prompt, items, callback)
-
Constructor
Parameters:
- TextMenu.new(timeout, callback)
-
Constructor
Parameters:
- timeout int Timeout in seconds. 0 means infinite.
- callback function Same as above
- TextMenu.new(callback)
-
Constructor
Parameters:
- callback function Same as above
- TextMenu:show()
- TextMenu:setTitle(title)
-
Parameters:
- title string
Returns:
-
self
- TextMenu:setItems(items)
-
Parameters:
- items table Array of strings
Returns:
-
self
- TextMenu:setPrompt(prompt)
-
Parameters:
- prompt string
Returns:
-
self
- TextMenu:setItem(index, item)
-
Parameters:
- index int The position of the item
- item string
Returns:
-
self
- TextMenu:cancel()