Class EditBox
A Frame with an editable text box.
This frame lets the user input arbitrary text into a box, which can be read and used by the rest of the interface. The text box can be either single-line or multi-line. Text can be selected by holding the Shift key, and natural navigation is available with the Left, Right, Up, Down, Home, End, Page Up, and Page Down keys. Copy and paste operations are also supported. The edit box can also remember the history of previously entered values or commands, which can be brought back at will. The characters entered as handled by the operating system, hence this class will use whatever keyboard layout is currently in use. Finally, the edit box can be configured to only accept numeric values (of either sign, or positive only), and to hide the input characters to simulate a password box (no encryption or other safety measure is used).
Note that an EditBox has Frame:enable_mouse set to true
and Frame:enable_drag set to "LeftButton"
by default.
Events. Hard-coded events available to all EditBoxes, in addition to those from Frame:
OnCursorChanged
: Triggered whenever the position of the edit cursor is changed (not yet implemented).OnEnterPressed
: Triggered when theEnter
(orReturn
) key is pressed while the edit box is focused. This captures both the main keyboard key and the smaller one on the numpad.OnEscapePressed
: Triggered when theEscape
key is pressed while the edit box is focused.OnSpacePressed
: Triggered when theSpace
key is pressed while the edit box is focused.OnTabPressed
: Triggered when theTab
key is pressed while the edit box is focused.OnUpPressed
: Triggered when theUp
key is pressed while the edit box is focused.OnDownPressed
: Triggered when theDown
key is pressed while the edit box is focused.OnTextChanged
: Triggered whenever the text contained in the edit box changes (character added or deleted, text set or pasted, etc.). Triggered afterOnChar
.OnTextSet
: Triggered by EditBox:set_text. Will always be followed byOnTextChanged
.
Inherits all methods from: Region, Frame.
Child classes: none.
Methods
Methods
- editbox:add_history_line()
- editbox:clear_history_lines()
- editbox:disable_password_mode()
- editbox:enable_password_mode()
- editbox:get_blink_time()
- editbox:get_cursor_position()
- editbox:get_history_lines()
- editbox:get_max_letters()
- editbox:get_letter_count()
- editbox:get_number()
- editbox:get_text()
- editbox:get_text_insets()
- editbox:highlight_text()
- editbox:insert()
- editbox:is_multi_line()
- editbox:is_numeric()
- editbox:is_password_mode_enabled()
- editbox:set_blink_time()
- editbox:set_cursor_position()
- editbox:set_font()
- editbox:set_max_history_lines()
- editbox:set_max_letters()
- editbox:set_multi_line()
- editbox:set_number()
- editbox:set_numeric()
- editbox:set_password_mode_enabled()
- editbox:set_text()
- editbox:set_text_insets()