SUIInputField
Dans cette classeOnValueChanged
- Fonctions
- On
Value Changed - On
End Edit - Activate
Input Field - Deactivate
Input Field - Select
- Propriétés
- Text
- Enabled
- Interactable
- Is
Focused - Caret
Blink Rate - Caret
Width - Character
Limit - Read
Only - Multi
Line - Asterisk
Char - Caret
Position - Selection
Anchor Position - Selection
Focus Position - Min
Width - Preferred
Width - Flexible
Width - Min
Height - Preferred
Height - Flexible
Height - Normal
Color - Highlighted
Color - Pressed
Color - Disabled
Color - Color
Multiplier - Game
Object
| Fonction | OnValueChanged | Given function will be called when text in Input Field has changed |
| Fonction | OnEndEdit | Given function will be called when editing has ended |
| Fonction | ActivateInputField | – |
| Fonction | DeactivateInputField | – |
| Fonction | Select | – |
| Propriété | Text | The current value of the input field. |
| Propriété | Enabled | Whether this Input Field component is Enabled |
| Propriété | Interactable | Is the Input Field interactable? |
| Propriété | IsFocused | Does the InputField currently have focus and is able to process events. |
| Propriété | CaretBlinkRate | The blinking rate of the input caret, defined as the number of times the blink cycle occurs per second. |
| Propriété | CaretWidth | The width of the caret in pixels. |
| Propriété | CharacterLimit | – |
| Propriété | ReadOnly | – |
| Propriété | MultiLine | If the input field supports multiple lines. |
| Propriété | AsteriskChar | The character used for password fields. |
| Propriété | CaretPosition | Current InputField caret position (also selection tail). |
| Propriété | SelectionAnchorPosition | The beginning point of the selection. |
| Propriété | SelectionFocusPosition | The end point of the selection. |
| Propriété | MinWidth | The minimum width this UIInputField may be allocated. (Used by the Layout system). |
| Propriété | PreferredWidth | The preferred width this UIInputField should be allocated if there is sufficient space. (Used by the Layout system) |
| Propriété | FlexibleWidth | The extra relative width this UIInputField should be allocated if there is additional available space. (Used by the Layout system) |
| Propriété | MinHeight | The minimum height this UIInputField may be allocated.(Used by the Layout system). |
| Propriété | PreferredHeight | The preferred height this UIInputField should be allocated if there is sufficient space. (Used by the Layout system) |
| Propriété | FlexibleHeight | The extra relative height this UIInputField should be allocated if there is additional available space. (Used by the Layout system) |
| Propriété | NormalColor | The normal color. |
| Propriété | HighlightedColor | The color of the control when it is highlighted. |
| Propriété | PressedColor | The color of the control when it is pressed. |
| Propriété | DisabledColor | The color of the control when it is disabled. |
| Propriété | ColorMultiplier | This multiplies the tint color for each transition by its value. |
| Propriété | GameObject | – |
Fonctions
OnValueChanged
Given function will be called when text in Input Field has changed
Paramètres
| Nom | Type | Valeur par défaut |
|---|---|---|
| callback | Closure | – |
Valeurs de retour
void
Exemple
function OVC()
--
end
Space.Host.ExecutingObject.UIInputField.OnValueChanged(OVC)
--This script will make an input field update a text field
--with character count in real-time every time a character is typed/removed
--[Text field and Input fields need to be added as references (scripting runtime)]
thisObject = Space.Host.ExecutingObject
inputField = Space.Host.GetReference("The Input Field").UIInputField
textField = Space.Host.GetReference("The Text Field").UIText
OnValueChanged = function()
textField.Text = "Count= " .. string.len(inputField.Text)
end
thisObject.UIInputField.OnValueChanged(OnValueChanged)
OnEndEdit
Given function will be called when editing has ended
Paramètres
| Nom | Type | Valeur par défaut |
|---|---|---|
| callback | Closure | – |
Valeurs de retour
void
Exemple
function OEE()
--
end
Space.Host.ExecutingObject.UIInputField.OnEndEdit(OEE)
--This script will make an input field update a text field
--as soon as someone has finished typing in it
--Text field and Input fields need to be added as references (scripting runtime)
thisObject = Space.Host.ExecutingObject
inputField = Space.Host.GetReference("The Input Field").UIInputField
textField = Space.Host.GetReference("The Text Field").UIText
OnEndEdit = function()
textField.Text = inputField.Text
end
Space.Host.ExecutingObject.UIInputField.OnEndEdit(OnEndEdit)
ActivateInputField
Valeurs de retour
void
Exemple
Space.Host.ExecutingObject.UIInputField.ActivateInputField()
DeactivateInputField
Valeurs de retour
void
Exemple
Space.Host.ExecutingObject.UIInputField.DeactivateInputField()
Select
Valeurs de retour
void
Exemple
Space.Host.ExecutingObject.UIInputField.DeactivateInputField()
Propriétés
Text
The current value of the input field.
Exemple
Space.Host.ExecutingObject.UIInputField.Text= "Hello"
--the below script makes this object set Browser URL according to what's written in text field
--[Required: This object needs a Browser and InputField objects to be added as reference to references section in Scripting Runtime component]
thisGameObject = Space.Host.ExecutingObject
webBrowser = Space.Host.GetReference("Browser")
urlField = Space.Host.GetReference("URL Field")
OnClick = function()
webBrowser.Browser.SetURL = urlField.UIInputField.Text
end
urlField.UIInputField.Text = https://www.youtube.com
thisGameObject.AddClickable()
thisGameObject.Clickable.Tooltip = "Click to set URL"
thisGameObject.Clickable.OnClick(OnClick)
Enabled
Whether this Input Field component is Enabled
Exemple
Space.Host.ExecutingObject.UIInputField.Enabled= true
--clicking this object will toggle a UIInputField's Enabled status
thisGameObject = Space.Host.ExecutingObject
inputfield = Space.Host.GetReference("inputfield").UIInputField
--make sure to add this reference to the Scripting Runtime component
OnClick = function()
inputfield.Enabled = not inputfield.Enabled
end
thisGameObject.AddClickable()
thisGameObject.Clickable.OnClick(OnClick)
Interactable
Is the Input Field interactable?
Exemple
Space.Host.ExecutingObject.UIInputField.Interactable= true
--clicking this object will toggle a UIInputField's interactable status
thisGameObject = Space.Host.ExecutingObject
inputfield = Space.Host.GetReference("inputfield").UIInputField
--make sure to add this reference to the Scripting Runtime component
OnClick = function()
inputfield.Interactable = not inputfield.Interactable
end
thisGameObject.AddClickable()
thisGameObject.Clickable.OnClick(OnClick)
IsFocusedLecture seule
Does the InputField currently have focus and is able to process events.
Exemple
hasFocus = Space.Host.ExecutingObject.UIInputField.IsFocused
CaretBlinkRate
The blinking rate of the input caret, defined as the number of times the blink cycle occurs per second.
Exemple
Space.Host.ExecutingObject.UIInputField.CaretBlinkRate= 3
CaretWidth
The width of the caret in pixels.
Exemple
Space.Host.ExecutingObject.UIInputField.CaretWidth= 4
CharacterLimit
Exemple
Space.Host.ExecutingObject.UIInputField.CharacterLimit= 8
ReadOnly
Exemple
Is the InputField read only?
--clicking this object will toggle a UIInputField's ReadOnly status
thisGameObject = Space.Host.ExecutingObject
inputfield = Space.Host.GetReference("inputfield").UIInputField
--make sure to add this reference to the Scripting Runtime component
OnClick = function()
inputfield.ReadOnly = not inputfield.ReadOnly
end
thisGameObject.AddClickable()
thisGameObject.Clickable.OnClick(OnClick)
MultiLineLecture seule
If the input field supports multiple lines.
Exemple
Space.Host.ExecutingObject.UIInputField.MultiLine = true
AsteriskChar
The character used for password fields.
Exemple
Space.Host.ExecutingObject.UIInputField.AsteriskChar= "%"
CaretPosition
Current InputField caret position (also selection tail).
Exemple
Space.Host.ExecutingObject.UIInputField.CaretPosition= 3
SelectionAnchorPosition
The beginning point of the selection.
Exemple
Space.Host.ExecutingObject.UIInputField.SelectionAnchorPosition= 1
SelectionFocusPosition
The end point of the selection.
Exemple
Space.Host.ExecutingObject.UIInputField.SelectionFocusPosition= 4
MinWidthLecture seule
The minimum width this UIInputField may be allocated. (Used by the Layout system).
Exemple
minWidth = Space.Host.ExecutingObject.UIInputField.MinWidth
PreferredWidthLecture seule
The preferred width this UIInputField should be allocated if there is sufficient space. (Used by the Layout system)
Exemple
prefWidth = Space.Host.ExecutingObject.UIInputField.PreferredWidth
FlexibleWidthLecture seule
The extra relative width this UIInputField should be allocated if there is additional available space. (Used by the Layout system)
Exemple
flexWidth = Space.Host.ExecutingObject.UIInputField.FlexibleWidth
MinHeightLecture seule
The minimum height this UIInputField may be allocated.(Used by the Layout system).
Exemple
minHeight = Space.Host.ExecutingObject.UIInputField.MinHeight
PreferredHeightLecture seule
The preferred height this UIInputField should be allocated if there is sufficient space. (Used by the Layout system)
Exemple
prefHeight = Space.Host.ExecutingObject.UIInputField.PreferredHeight
FlexibleHeightLecture seule
The extra relative height this UIInputField should be allocated if there is additional available space. (Used by the Layout system)
Exemple
flexHeight = Space.Host.ExecutingObject.UIInputField.FlexibleHeight
NormalColor
The normal color.
Exemple
Space.Host.ExecutingObject.UIInputField.NormalColor = Color.Red
HighlightedColor
The color of the control when it is highlighted.
Exemple
Space.Host.ExecutingObject.UIInputField.HighlightedColor = Color.Red
PressedColor
The color of the control when it is pressed.
Exemple
Space.Host.ExecutingObject.UIInputField.PressedColor = Color.Red
DisabledColor
The color of the control when it is disabled.
Exemple
Space.Host.ExecutingObject.UIInputField.DisabledColor = Color.Red
ColorMultiplier
This multiplies the tint color for each transition by its value.
Exemple
Space.Host.ExecutingObject.UIInputField.ColorMultiplier = Color.Red
GameObjectLecture seule
Exemple
``` theGameObject = Space.Host.ExecutingObject.UIInputField.GameObject ```



