Given function will be called when text in Input Field has changed
Parameter
Type
Description
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
void OnEndEdit (Closure callback)
Given function will be called when editing has ended
Parameter
Type
Description
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)
--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)
--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)
--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)
IsFocused
bool IsFocusedget
Does the InputField currently have focus and is able to process events.
--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)