s&
About
The Project
info
About s&box
map
Roadmap
monitoring
Metrics
Engine startup and usage numbers
Updates
newspaper
Latest News
published_with_changes
Changes
Release-by-release changelog
Games
Browse Games
Discover Games
gamejams
live now
Game Jam III
Ends
Fri 25 Sep
Theme
One More Round
The jam is running. Build something, or play the entries.
£
50,000
prizepool
View the jam
Workshop
Playable
sports_esports
Games
Standalone games and gamemodes
Assets
landscape
Maps
view_in_ar
Models
texture
Materials
apparel
Clothing
apps
Everything
Every asset type in one list
Forum
Learn
Documentation
rocket_launch
Getting Started
docs
Documentation
api
API Reference
Resources
school
Tutorials
manage_search
Code Search
input
Log in with Steam
chevron_left
Change Language
简体中文
English
Русский
Español
Português-Brasil
Deutsch
日本語
Français
Polski
Türkçe
한국어
Pirate
Italiano
ไทย
繁體中文
Українська
Čeština
Nederlands
Magyar
Dansk
Suomi
Svenska
Norsk
Ελληνικά
Română
Български
Tiếng Việt
Bahasa Indonesia
Español-Latinoamérica
العربية
Api
Classes
TextEntry
chevron_left
Classes
class
TextEntry
Constructors
functions
TextEntry
Fields
lock
TimeSinceCaretMoved
Properties
data_object
AcceptsImeInput
data_object
AllowEmojiReplace
data_object
AutoComplete
lock
CanEdit
data_object
CanRedo
data_object
CanUndo
data_object
CaretPosition
data_object
CharacterRegex
data_object
Disabled
data_object
HasClearButton
data_object
HasValidationErrors
data_object
HistoryCookie
data_object
HistoryMaxItems
data_object
Icon
data_object
IconPanel
lock
Label
data_object
MaxLength
data_object
MaxValue
data_object
MinLength
data_object
MinValue
data_object
Multiline
data_object
NumberFormat
data_object
Numeric
data_object
OnTextEdited
data_object
Placeholder
data_object
Prefix
data_object
PrefixLabel
data_object
ReadOnly
data_object
SelectionColor
data_object
StringRegex
data_object
Suffix
data_object
SuffixLabel
data_object
SupportsMultiEdit
data_object
Text
data_object
TextLength
data_object
Value
data_object
WholeNumbers
Methods
functions
AddToHistory
lock
AutoCompleteCancel
lock
AutoCompleteSelectionChanged
functions
CanEnterCharacter
functions
ClearHistory
functions
ClearUndoHistory
functions
DestroyAutoComplete
functions
FixNumeric
functions
GetClipboardValue
lock
IsPanelEmpty
lock
OnBlur
functions
OnButtonEvent
functions
OnButtonTyped
lock
OnDoubleClick
lock
OnDragSelect
functions
OnDraw
lock
OnDrop
lock
OnEscape
lock
OnEvent
lock
OnFocus
functions
OnKeyTyped
lock
OnMouseDown
lock
OnMouseMove
lock
OnMouseUp
functions
OnPaste
lock
OnTripleClick
functions
OnValueChanged
functions
Redo
functions
SetProperty
functions
Tick
functions
Undo
functions
UpdateAutoComplete
functions
UpdateValidation
TextEntry
A Sandbox.UI.Panel that the user can enter text into.
class
Sandbox.UI
.
account_tree
extends
BaseControl
Sandbox.Engine
build
Constructors
1
TextEntry
(
)
crop_din
Fields
1
TimeSinceCaretMoved
RealTimeSince
How long since the caret last moved or the text changed. The caret stays solid for a moment after either, so it isn't blinking out from under someone who is typing.
data_object
Properties
37
AcceptsImeInput
bool
Allow IME input when this is focused.
AllowEmojiReplace
bool
Whether to allow automatic replacement of emoji codes with their actual unicode emoji characters. See Sandbox.UI.Emoji.
AutoComplete
Func`2
If you hook a method up here we'll do autocomplete on it. Return a list if strings for given string input.
CanEdit
bool
Whether the text can be changed at all right now.
CanRedo
bool
Is there anything to redo?
CanUndo
bool
Is there anything to undo?
CaretPosition
int
CharacterRegex
string
If set, will block the input of any character that doesn't match. Will also set Sandbox.UI.TextEntry.HasValidationErrors accordingly.
Disabled
bool
Is the text entry disabled? If disabled, will add a "disabled" class and prevent focus.
HasClearButton
bool
If true then Icon/IconPanel will be set to a clear button that clears the text when clicked.
HasValidationErrors
bool
If true then this control has validation errors and the input shouldn't be accepted.
HistoryCookie
string
If set, the history of this text entry will be stored and restored using this key in the local Sandbox.Internal.GlobalGameNamespace.Cookie.
HistoryMaxItems
int
Maximum amount of items Sandbox.UI.TextEntry.AddToHistory(System.String) will keep. Oldest items will be discarded as new ones are added.
Icon
string
If set, will display a material icon at the end of the text entry.
IconPanel
IconPanel
The Sandbox.UI.IconPanel that displays Sandbox.UI.TextEntry.Icon
Label
Label
The Sandbox.UI.TextEntry.Label that contains the text of this text entry.
MaxLength
Nullable`1
If set, visually signals when the input text is longer than this value. Will also set Sandbox.UI.TextEntry.HasValidationErrors accordingly.
MaxValue
Nullable`1
If we're numeric, this is the highest numeric value allowed
MinLength
Nullable`1
If set, visually signals when the input text is shorter than this value. Will also set Sandbox.UI.TextEntry.HasValidationErrors accordingly.
MinValue
Nullable`1
If we're numeric, this is the lowest numeric value allowed
Multiline
bool
Makes it possible to enter new lines into the text entry. (By pressing the Enter key, which no longer acts as the submit key)
NumberFormat
string
Affects formatting of the text when Sandbox.UI.TextEntry.Numeric is enabled. Accepts any format that is supported by System.Single.ToString(System.String). See examples here.
Numeric
bool
When set to true, ensures only numeric values can be typed. Also applies Sandbox.UI.TextEntry.FixNumeric on text.
OnTextEdited
Action`1
Called when the text of this text entry is changed.
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.
Prefix
string
If set, will display given text before the text entry box.
PrefixLabel
Label
The Sandbox.UI.TextEntry.Label that shows Sandbox.UI.TextEntry.Prefix text.
ReadOnly
bool
The text can be selected and copied, but not changed. Unlike Sandbox.UI.TextEntry.Disabled this still takes focus, so it reads and behaves like text rather than like a dead control.
SelectionColor
Color
The color used for text selection highlight. Defaults to cyan with transparency.
StringRegex
string
If set, Sandbox.UI.TextEntry.HasValidationErrors will return true if doesn't match regex.
Suffix
string
If set, will display given text after the text entry box.
SuffixLabel
Label
The Sandbox.UI.TextEntry.Label that shows Sandbox.UI.TextEntry.Suffix text.
SupportsMultiEdit
bool
Text
string
Access to the raw text in the text entry.
TextLength
int
Value
string
The value of the text entry. Returns Sandbox.UI.TextEntry.Text, but does special logic when setting text.
WholeNumbers
bool
With Sandbox.UI.TextEntry.Numeric, only allow whole numbers - no decimal point.
functions
Methods
33
AddToHistory
(
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.
AutoCompleteCancel
(
)
Auto complete was canceled, restore text to what it was before we started, and remove the auto complete popup.
AutoCompleteSelectionChanged
(
)
Auto complete selection has changed. Update the text entry text to that selected value.
CanEnterCharacter
(
c
)
bool
Called when a character is typed by the player.
ClearHistory
(
)
Clear the input history that was previously added via Sandbox.UI.TextEntry.AddToHistory(System.String).
ClearUndoHistory
(
)
Throw the history away - for when the text is replaced by something the user didn't do.
DestroyAutoComplete
(
)
Close and delete the auto complete popup panel.
FixNumeric
(
)
string
Called to ensure the Sandbox.UI.TextEntry.Text is absolutely in the correct format, in this case - a valid number format.
GetClipboardValue
(
cut
)
string
IsPanelEmpty
(
)
bool
The TextEntry has the :empty style when the text is unset
OnBlur
(
e
)
OnButtonEvent
(
e
)
OnButtonTyped
(
e
)
OnDoubleClick
(
e
)
OnDragSelect
(
e
)
OnDraw
(
)
OnDrop
(
e
)
OnEscape
(
e
)
OnEvent
(
e
)
OnFocus
(
e
)
OnKeyTyped
(
k
)
OnMouseDown
(
e
)
OnMouseMove
(
e
)
OnMouseUp
(
e
)
OnPaste
(
text
)
OnTripleClick
(
e
)
A third click takes the whole line - which is everything, when there's only one line.
OnValueChanged
(
)
Called when the text entry's value changes.
Redo
(
)
Put back whatever the last undo took away.
SetProperty
(
name
,
value
)
Tick
(
)
Undo
(
)
Put back the text, caret and selection from before the last edit.
UpdateAutoComplete
(
)
Open the auto complete popup with values from Sandbox.UI.TextEntry.AutoComplete. Close the popup if we have no auto complete entries.
UpdateValidation
(
)
Update the validation state of this control.
Inheritance
Panel
BaseControl
TextEntry
NumberEntry
NumberEntry
people
Log in to reply
You can't reply if you're not logged in. That would be crazy.