Files
Basalt/docs/docs1_6/objects/Input.md
Robert Jelic bb1b1beb79 Basalt 1.7 Update
- New Objects (Flexbox, Graph, Treeview)
- Pluginsystem to add/remove functionality
- Reworked the entire Object system, instead of one big Object Class we have multiple classes: Object, VisualObject, ChangeableObject
- Instead of one big Frame Class we have multiple Frame Classes: BaseFrame, Frame, MovableFrame, ScrollableFrame, MonitorFrame, Flexbox
- Removed the Animation Object, and added a animation plugin instead
- Removed the Graphic Object and merged it's functionality with the image object
- Updated currently existing objects
2023-04-30 17:05:34 +02:00

2.1 KiB

With input's you are able to create a object where the user can type something in.

Here are all possible functions available for inputs:
Remember Input inherits from Object

setInputType

Changes the input type. default: text

Parameters:

  1. string input type ("text", "password", "number")

Returns:

  1. object The object in use

Usage:

  • Creates a default input and sets it to numbers only.
local mainFrame = basalt.createFrame()
local aInput = mainFrame:addInput():setInputType("number")
<input type="number" />

getInputType

Gets the current input type

Returns:

  1. string input type

Usage:

  • Creates a default input and sets it to numbers only. Also prints the current input type to log.
local mainFrame = basalt.createFrame()
local aInput = mainFrame:addInput():setInputType("number")
basalt.debug(aInput:getInputType())

setDefaultText

Sets the default text. This will only be displayed if there is no input set by the user.

Parameters:

  1. string input type ("text", "password", "number")
  2. number|color default background color - optional
  3. number|color default text color - optional

Returns:

  1. object The object in use

Usage:

  • Creates a default input and sets the default text to "...".
local mainFrame = basalt.createFrame()
local aInput = mainFrame:addInput():setDefaultText("...")
<input default="..." />

setInputLimit

Sets a character limit to the input.

Parameters:

  1. number character limit

Returns:

  1. object The object in use

Usage:

  • Creates a default input and sets the character limit to 8.
local mainFrame = basalt.createFrame()
local aInput = mainFrame:addInput():setInputLimit(8)
<input limit="8" />

getInputLimit

Returns the input limit.

Returns:

  1. number character limit

Usage:

  • Creates a default input and sets the character limit to 8. Prints the current limit.
local mainFrame = basalt.createFrame()
local aInput = mainFrame:addInput():setInputLimit(8)
basalt.debug(aInput:getInputLimit())