- 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
3.4 KiB
3.4 KiB
Textfields are objects, where the user can write something on multiple lines. it act's like the default edit script (without coloring)
Remember textfield inherits from Object
getLines
Returns all lines
Returns:
tablelines
Usage:
- Prints all lines
local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aTextfield = mainFrame:addTextfield("myFirstTextfield"):show()
basalt.debug(aTextfield:getLines())
getLine
Returns the line on index position
Parameteres:
numberindex
Returns:
stringline
Usage:
- Prints one line
local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aTextfield = mainFrame:addTextfield("myFirstTextfield"):show()
basalt.debug(aTextfield:getLine(1))
editLine
Edits the line on index position
Parameteres:
numberindexstringtext
Returns:
objectThe object in use
Usage:
- Edits the line
local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aTextfield = mainFrame:addTextfield("myFirstTextfield"):show()
basalt.debug(aTextfield:editLine(1, "Hello!"))
addLine
Adds a line on index position
Parameteres:
stringtextnumberindex
Returns:
objectThe object in use
Usage:
- Adds a line
local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aTextfield = mainFrame:addTextfield("myFirstTextfield"):show()
basalt.debug(aTextfield:addLine("Hello!", 1))
<textfield>
<lines>
<line>Hello!</line>
</lines>
</textfield>
removeLine
Removes the line on index position
Parameteres:
numberindexstringtext
Returns:
objectThe object in use
Usage:
- Removes a line
local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aTextfield = mainFrame:addTextfield("myFirstTextfield"):show()
basalt.debug(aTextfield:removeLine())
getTextCursor
Gets text cursor position
Returns:
numberx positionnumbery position
addKeywords
Adds keywords for special coloring
Parameteres:
number|colorcolor of your choicetablea list of keywords which should be colored example: {"if", "else", "then", "while", "do"}
Returns:
objectThe object in use
Usage:
- Changes the color of some words to purple
local mainFrame = basalt.createFrame()
local aTextfield = mainFrame:addTextfield():addKeywords(colors.purple, {"if", "else", "then", "while", "do", "hello"})
<textfield>
<keywords>
<purple>
<keyword>if</keyword>
<keyword>else</keyword>
<keyword>then</keyword>
<keyword>while</keyword>
<keyword>do</keyword>
<keyword>hello</keyword>
</purple>
</keywords>
</textfield>
addRule
Adds a new rule for special coloring
Parameteres:
stringa pattern - check out this page: (https://riptutorial.com/lua/example/20315/lua-pattern-matching)number|colortext colornumber|colorbackground color - optional
Returns:
objectThe object in use
Usage:
- Changes the color of all numbers
local mainFrame = basalt.createFrame()
local aTextfield = mainFrame:addTextfield():addRule("%d", colors.lightBlue)
<textfield>
<rules>
<rule>
<pattern>%d</pattern>
<fg>lightBlue</fg>
</rule>
</rules>
</textfield>