Files
Basalt/docs/objects/Input.md
Larry Rowe 1d50585bfc Update Input.md
Added that input objects are derived from ChangeableObject.
2024-10-01 13:33:50 -04:00

1.2 KiB

Input objects allow you to create a field where the user can enter text.

Input objects are derived from Object, VisualObject, and ChangeableObject. Input objects have the following additional methods:

setInputType Sets the input type
getInputType Returns the input type
setDefaultText Sets the default text
setInputLimit Sets a limit to the number of characters that can be entered
getInputLimit Returns the character limit
setOffset Changes the offset inside the input
getOffset Returns the input offset
setTextOffset Changes the cursor position
getTextOffset Returns the cursor position

Here's an example of how to create an Input object and set its properties:

Lua:

local main = basalt.createFrame()
local anInput = main:addInput()
anInput:setInputType("text")
anInput:setDefaultText("Username")
anInput:setInputLimit(20)

XML:

<input type="text" defaultText="Username" inputLimit="20" />