Difference between revisions of "UI.SimpleMenu"

From Nomad DB
 
(3 intermediate revisions by the same user not shown)
Line 15: Line 15:
 
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.
 
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===
 
===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.
+
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===
 +
{| class="wikitable"
 +
|+
 +
!Supported Versions
 +
!Type
 +
!Screenshot
 +
!Description
 +
!Methods
 +
|-
 +
| rowspan="3" |All
 +
|'''Button'''
 +
|[[File:UI-SimpleMenu-Button.png|center|frameless]]
 +
|A button with text. Triggers a callback when Numpad 5 is pressed.
 +
|[[UISimpleMenu:AddButton]]
 +
|-
 +
|'''Checkbox'''
 +
|[[File:UI-SimpleMenu-Checkbox.png|center|frameless]]
 +
|Can be checked and unchecked using Numpad 5. Triggers an element when the checked state changes.
 +
|[[UISimpleMenu:AddCheckbox]]
 +
 
 +
[[UISimpleMenu:IsChecked]]
 +
 
 +
[[UISimpleMenu:SetChecked]]
 +
|-
 +
|'''Search'''
 +
|[[File:UI-SimpleMenu-Search.png|center|frameless]]
 +
|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]]
 +
|-
 +
| rowspan="2" |Legion ScriptHook & Mafia DE ScriptHook
 +
|'''List'''
 +
|[[File:UI-SimpleMenu-List.png|center|frameless]]
 +
|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'''
 +
|[[File:UI-SimpleMenu-Text.png|center|frameless]]
 +
|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==
 
==Methods==
Line 35: Line 84:
 
*[[UISimpleMenu:SetEntryText]]
 
*[[UISimpleMenu:SetEntryText]]
 
*[[UISimpleMenu:AddSearch]]
 
*[[UISimpleMenu:AddSearch]]
 +
*[[UISimpleMenu:AddText]]
  
 
=====Button=====
 
=====Button=====
Line 45: Line 95:
 
*[[UISimpleMenu:IsChecked]]
 
*[[UISimpleMenu:IsChecked]]
 
*[[UISimpleMenu:SetChecked]]
 
*[[UISimpleMenu:SetChecked]]
 +
 +
====List====
 +
 +
*[[UISimpleMenu:AddList]]
 +
*[[UISimpleMenu:AddListEntry]]
 +
*[[UISimpleMenu:GetSelectedListEntry]]
 +
*[[UISimpleMenu:SelectListEntryByValue]]
 +
*[[UISimpleMenu:SelectListEntryByIndex]]
  
 
====Events====
 
====Events====
  
 
*[[UISimpleMenu:OnUpdate]]
 
*[[UISimpleMenu:OnUpdate]]
 +
*[[UISimpleMenu:OnSelection]]
 +
*[[UISimpleMenu:OnActivate]]
 +
*[[UISimpleMenu:OnDeactivate]]
  
 
==Controls==
 
==Controls==

Latest revision as of 18:43, 20 October 2021

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