Editbox
Classes
Class: Editbox
Extends Widget, Editboxbase
Warning: All methods for this class are broken. Use X2Editbox.
A
Editboxwidget allows users to enter and edit string or numeric values. Supports focus management, history tracking, digit-only and password modes, input validation policies, prefix text rendering, and configurable insets. Provides utilities for controlling composition state behavior, selection handling on focus, and various input constraints.Dependencies:
- TextStyle used for the
prefixStylefield.
Field: prefixStyle
TextStyle
The text style applied to the optional prefix text.
Method: SetInset
(method) Editbox:SetInset(left: number, top: number, right: number, bottom: number)
Sets the inset for the Editbox.
@param
left— The left inset.@param
top— The top inset.@param
right— The right inset.@param
bottom— The bottom inset.
Method: SetInitVal
(method) Editbox:SetInitVal(val: number)
Sets the initial value for the Editbox.
@param
val— The initial value.
Method: SetHistoryLines
(method) Editbox:SetHistoryLines(count: number)
Sets the maximum number of history lines for the Editbox.
@param
count— The maximum number of history lines. (default:0)
Method: SetFocus
(method) Editbox:SetFocus()
Sets focus to the Editbox.
Method: SetPassword
(method) Editbox:SetPassword(password: boolean)
Enables or disables password mode for the Editbox.
@param
password—trueto enable password mode,falseto disable. (default:false)
Method: SetPrefixInset
(method) Editbox:SetPrefixInset(left: number, top: number, right: number, bottom: number)
Sets the inset for the prefix text in the Editbox.
@param
left— The left inset for the prefix.@param
top— The top inset for the prefix.@param
right— The right inset for the prefix.@param
bottom— The bottom inset for the prefix.
Method: SetPossibleFirstZero
(method) Editbox:SetPossibleFirstZero(possibleFirstZero: boolean)
Enables or disables allowing a leading zero in digit input.
@param
possibleFirstZero—trueto allow leading zero,falseto disallow. (default:false)
Method: SetReClickable
(method) Editbox:SetReClickable(click: boolean)
Enables or disables re-clickable behavior for the Editbox.
@param
click—trueto enable re-clicking,falseto disable.
Method: SetPrefixText
(method) Editbox:SetPrefixText(prefixText: string)
Sets the prefix text for the Editbox.
@param
prefixText— The prefix text to display.
Method: UseSelectAllWhenFocused
(method) Editbox:UseSelectAllWhenFocused(use: boolean)
Enables or disables selecting all text when the Editbox gains focus.
@param
use—trueto select all text on focus,falseto disable. (default:true)
Method: SetEnglish
(method) Editbox:SetEnglish(english: boolean)
Sets the English input mode for the Editbox.
@param
english—trueto enable English input mode,falseto disable. (default:false)
Method: SetDigitEmpty
(method) Editbox:SetDigitEmpty(empty: boolean)
Sets whether the Editbox allows empty digit input.
@param
empty—trueto allow empty input,falseto disallow. (default:false)
Method: ClearString
(method) Editbox:ClearString()
Clears the string content of the Editbox.
Method: ClearFocus
(method) Editbox:ClearFocus()
Clears focus from the Editbox.
Method: CheckNamePolicy
(method) Editbox:CheckNamePolicy(nameType: `NRT_CHARACTER`|`NRT_CHAT_TAB`|`NRT_CUSTOM`|`NRT_FACTION_ROLE`|`NRT_FACTION`...(+6))
Checks the name policy for the Editbox.
@param
nameType— The name type to check against.-- api/X2Util nameType: | `NRT_CHARACTER` | `NRT_CHAT_TAB` | `NRT_CUSTOM` | `NRT_FACTION` | `NRT_FACTION_ROLE` | `NRT_FAMILY` | `NRT_FAMILY_TITLE` | `NRT_MAX` | `NRT_PORTAL` | `NRT_ROSTER_TITLE` | `NRT_SUMMONS`
Method: SetDigitMax
(method) Editbox:SetDigitMax(max: number)
Sets the maximum value for digit input in the Editbox.
@param
max— The maximum digit value.
Method: IsDigit
(method) Editbox:IsDigit()
-> digit: boolean
Checks if the Editbox content is restricted to digits.
@return
digit—trueif restricted to digits,falseotherwise. (default:false)
Method: IsPassword
(method) Editbox:IsPassword()
-> password: boolean
Checks if the Editbox is set as a password field.
@return
password—trueif set as password,falseotherwise. (default:false)
Method: IsNowComposition
(method) Editbox:IsNowComposition()
-> boolean
Checks if the Editbox is in a composition state (e.g., IME input).
@return —
trueif in composition state,falseotherwise. (default:false)
Method: SetDigit
(method) Editbox:SetDigit(digit: boolean)
Enables or disables digit-only input for the Editbox.
@param
digit—trueto restrict to digits,falseto allow all characters. (default:false)
Method: AddHistoryLine
(method) Editbox:AddHistoryLine(text: string)
Adds a text entry to the Editbox history.
@param
text— The text to add to the history.