Api Sandbox UI TextEntry
class

TextEntry

public class TextEntry : BaseControl

A Panel that the user can enter text into.

Constructors

TextEntry()

Properties

Name Type Description
AutoComplete Func<String, Object[]> If you hook a method up here we'll do autocomplete on it. Return a list if strings for given string input.
SupportsMultiEdit virtual Boolean
OnTextEdited Action<String> Called when the text of this text entry is changed.
Disabled Boolean Is the text entry disabled? If disabled, will add a "disabled" class and prevent focus.
Text String Access to the raw text in the text entry.
Value String The value of the text entry. Returns Text, but does special logic when setting text.
TextLength Int32
CaretPosition Int32
HasContent virtual Boolean
AllowEmojiReplace Boolean Whether to allow automatic replacement of emoji codes with their actual unicode emoji characters. See Emoji.
AcceptsImeInput virtual Boolean Allow IME input when this is focused.
NumberFormat String Affects formatting of the text when Numeric is enabled. Accepts any format that is supported by String). See examples here.
Multiline Boolean Makes it possible to enter new lines into the text entry. (By pressing the Enter key, which no longer acts as the submit key)
MinValue Single? If we're numeric, this is the lowest numeric value allowed
MaxValue Single? If we're numeric, this is the highest numeric value allowed
Placeholder String Text to display when the text entry is empty. Typically a very short description of the expected contents or function of the text entry.
PrefixLabel Label The Label that shows Prefix text.
Prefix String If set, will display given text before the text entry box.
SuffixLabel Label The Label that shows Suffix text.
Suffix String If set, will display given text after the text entry box.
SelectionColor Color The color used for text selection highlight. Defaults to cyan with transparency.
HistoryMaxItems Int32 Maximum amount of items String) will keep. Oldest items will be discarded as new ones are added.
HistoryCookie String If set, the history of this text entry will be stored and restored using this key in the local Cookie.
IconPanel IconPanel The IconPanel that displays Icon
Icon String If set, will display a material icon at the end of the text entry.
HasClearButton Boolean If true then Icon/IconPanel will be set to a clear button that clears the text when clicked.
MinLength Int32? If set, visually signals when the input text is shorter than this value. Will also set HasValidationErrors accordingly.
MaxLength Int32? If set, visually signals when the input text is longer than this value. Will also set HasValidationErrors accordingly.
CharacterRegex String If set, will block the input of any character that doesn't match. Will also set HasValidationErrors accordingly.
StringRegex String If set, HasValidationErrors will return true if doesn't match regex.
Numeric Boolean When set to true, ensures only numeric values can be typed. Also applies FixNumeric on text.
HasValidationErrors Boolean If true then this control has validation errors and the input shouldn't be accepted.

Methods

Void UpdateAutoComplete()

Open the auto complete popup with values from AutoComplete. Close the popup if we have no auto complete entries.

Void UpdateAutoComplete(Object[] options)

Open the auto complete popup with given values.

virtual Void DestroyAutoComplete()

Close and delete the auto complete popup panel.

virtual Void OnPaste(String text)
virtual String GetClipboardValue(Boolean cut)
virtual Void OnButtonEvent(ButtonEvent e)
virtual Void OnButtonTyped(ButtonEvent e)
virtual Void OnKeyTyped(Char k)
virtual Void BuildContentCommandList(CommandList commandList, RenderState state)
virtual Void OnValueChanged()

Called when the text entry's value changes.

virtual Void Tick()
virtual Void SetProperty(String name, String value)
virtual String FixNumeric()

Called to ensure the Text is absolutely in the correct format, in this case - a valid number format.

returns — The correctly formatted version of Text.
Void AddToHistory(String str)

Add given string to the history of this text entry. The history can be accessed by the player by pressing up and down arrows with an empty text entry.

Void ClearHistory()

Clear the input history that was previously added via String).

Void UpdateValidation()

Update the validation state of this control.

virtual Boolean CanEnterCharacter(Char c)

Called when a character is typed by the player.

c — The typed character to test.
returns — Return true to allow the character to be typed.
Assembly: Base Library Namespace: Sandbox.UI Full Name: Sandbox.UI.TextEntry