From 974cad146641e4bcc76474b2666593e6fd9346d9 Mon Sep 17 00:00:00 2001 From: Robert Jelic <36573031+NoryiE@users.noreply.github.com> Date: Sun, 26 Jun 2022 19:17:58 +0200 Subject: [PATCH] Update Input.md --- docs/objects/Input.md | 77 ++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 73 insertions(+), 4 deletions(-) diff --git a/docs/objects/Input.md b/docs/objects/Input.md index a445c3c..6344524 100644 --- a/docs/objects/Input.md +++ b/docs/objects/Input.md @@ -4,10 +4,79 @@ Here are all possible functions available for inputs:
Remember Input inherits from [Object](objects/Object.md) ## setInputType -changes the input type +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. ```lua local mainFrame = basalt.createFrame("myFirstFrame"):show() -local aInput = mainFrame:addInput("myFirstInput"):setInputType("password"):show() +local aInput = mainFrame:addInput("myFirstInput"):setInputType("number"):show() +``` + +## 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. +```lua +local mainFrame = basalt.createFrame("myFirstFrame"):show() +local aInput = mainFrame:addInput("myFirstInput"):setInputType("number"):show() +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 "...". +```lua +local mainFrame = basalt.createFrame("myFirstFrame"):show() +local aInput = mainFrame:addInput("myFirstInput"):setInputType("number"):setDefaultText(...):show() +``` + +## 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. +```lua +local mainFrame = basalt.createFrame("myFirstFrame"):show() +local aInput = mainFrame:addInput("myFirstInput"):setInputLimit(8):show() +``` + +## 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. +```lua +local mainFrame = basalt.createFrame("myFirstFrame"):show() +local aInput = mainFrame:addInput("myFirstInput"):setInputLimit(8):show() +basalt.debug(aInput:getInputLimit()) ``` -#### Parameters: string value ("text", "password", "number")
-#### Returns: self