-
Notifications
You must be signed in to change notification settings - Fork 40
Textfield
Textfields are objects, where the user can write something on multiple lines. it act's like the default edit script (without coloring)
Here is a example of how to create a default textfield:
local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aTextfield = mainFrame:addTextfield("myFirstTextfield"):show()
This will create a default textfield with the size 10 width and 4 height on position 1 1 (relative to its parent frame), the default background is colors.gray, the default text color is colors.black and the default zIndex is 5.
A list of all possible functions available for textfields. Remember textfield inherits from object:
returns all lines
local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aTextfield = mainFrame:addTextfield("myFirstTextfield"):show()
basalt.debug(aTextfield:getLines())
parameters: -
returns: table lines
returns the line on index position
local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aTextfield = mainFrame:addTextfield("myFirstTextfield"):show()
basalt.debug(aTextfield:getLine(2))
parameters: number index
returns: string line
edits line on index position
local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aTextfield = mainFrame:addTextfield("myFirstTextfield"):show()
aTextfield:editLine(2, "hellow")
parameters: number index, string text
returns: self
adds a line on index position (if index is nil it just adds the line on the bottom)
local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aTextfield = mainFrame:addTextfield("myFirstTextfield"):show()
aTextfield:addLine("hellow")
parameters: string text, number index
returns: self
removes the line on index position
local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aTextfield = mainFrame:addTextfield("myFirstTextfield"):show()
aTextfield:removeLine(1)
parameters: number index
returns: self
returns the cursor position
local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aTextfield = mainFrame:addTextfield("myFirstTextfield"):show()
basalt.debug(aTextfield:getTextCursor())
parameters: -
returns: number x, number y
Thanks for checking out our wiki, join our discord for more help: discord.gg/yM7kndJdJJ