UI.SimpleMenu

From Nomad DB
SimpleMenu from Trainer

Creates a SimpleMenu, an ingame menu which can be controlled by the arrow keys & numpad keys. The name comes from its (currently) limited functionality and aims to provide very basic, but useful menu functionality.

This function has to be called from inside a Script. If you wish to handle Text input from users, use UI.SimpleTextInput.

Syntax

UI.SimpleMenu()
  • Returns UISimpleMenu instance

Remarks

The Menu will be invisible until a call to UISimpleMenu:Activate or UISimpleMenu:Toggle. You can easily bind a Menu to a Key, see UISimpleMenu:Toggle for more information.

Entry and Entry Index

Every item inside the SimpleMenu is called Entry. There are different types of Entry (Button, Checkbox, Search, etc.). Every entry that is added to a SimpleMenu receives an "index" which can be used to modify it later.

Entry Types

Supported Versions Type Screenshot Description Methods
All Button
UI-SimpleMenu-Button.png
A button with text. Triggers a callback when Numpad 5 is pressed. UISimpleMenu:AddButton
Checkbox
UI-SimpleMenu-Checkbox.png
Can be checked and unchecked using Numpad 5. Triggers an element when the checked state changes. UISimpleMenu:AddCheckbox

UISimpleMenu:IsChecked

UISimpleMenu:SetChecked

Search
UI-SimpleMenu-Search.png
Allows searching through all the elements in the menu. Once text is entered, they are filtered according to a "Fuzzy"-Search (case-insensitive). Entries which do not fit the filter are hidden. Triggers no callback. UISimpleMenu:AddSearch
Legion ScriptHook & Mafia DE ScriptHook List
UI-SimpleMenu-List.png
Supports multiple entries which can be selected using Numpad 4/6 and Arrows Left/Right. A callback is triggered every time the selected element changes. UISimpleMenu:AddList

UISimpleMenu:AddListEntry

UISimpleMenu:GetSelectedListEntry

UISimpleMenu:SelectListEntryByValue

UISimpleMenu:SelectListEntryByIndex

Text
UI-SimpleMenu-Text.png
Text field which supports multi-line text and word-wrapping. Stretches automatically to fit the size of the text. This entry can not be selected and triggers no callback. UISimpleMenu:AddText

Methods

Menu State

Entries

Button
Checkbox

List

Events

Controls

Up/Down Arrows Navigation
Numpad 8(Up), Numpad 9 (Down)
Enter Confirm Option
Numpad 5
Delete Key, Numpad 0 Return back to previous menu
ESC Close the menu

Related Pages