1.7 stuff

The master branch was reverted to 1.7 because it was very unstable (bugs and stuff that wasn't mentioned on the documentation page yet) - features will come back with 2.0

- fixed debug window
- fixed flexbox not sending drag events to it's children

- small docs updates for 1.7
- removed the examples because the are outdated
This commit is contained in:
Robert Jelic
2024-03-13 09:57:07 +01:00
parent 33753f6d8f
commit 8168fa4465
75 changed files with 2839 additions and 2844 deletions

View File

@@ -0,0 +1,23 @@
## clear
### Description
Clears the entire content of a Textfield object, removing all text currently displayed within it.
### Returns
1. `object ` The object in use
### Usage
```lua
local basalt = require("basalt")
local mainFrame = basalt.createFrame()
local aTextfield = mainFrame:addTextfield()
-- Assume there is some content in the Textfield
aTextfield:clear() -- Clear the entire content
basalt.autoUpdate()
```

View File

@@ -0,0 +1,30 @@
## addRule
### Description
Edits an existing rule for special coloring in a Textfield object. This allows you to modify the color and/or background color applied to text matching a specific pattern.
### Parameteres
1. `string` pattern - The Lua pattern used to match the text you want to edit the coloring for.
2. `number|color` textColor - The new color you want to apply to the text matching the pattern.
3. `number|color` backgroundColor - (optional) The new background color you want to apply to the text matching the pattern.
### Returns
1. `object` The object in use
### Usage
* Modifies the color of all numbers in a Textfield object.
```lua
local basalt = require("basalt")
local mainFrame = basalt.createFrame()
local aTextfield = mainFrame:addTextfield()
aTextfield:editRule("%d", colors.red) -- Changes the color of numbers to red
basalt.autoUpdate()
```

View File

@@ -0,0 +1,26 @@
## getOffset
### Description
Retrieves the current offset within a Textfield object, providing information about the current viewable portion of the text.
### Returns
1. `number` The current horizontal offset within the Textfield.
2. `number` The current vertical offset within the Textfield.
### Usage
```lua
local basalt = require("basalt")
local mainFrame = basalt.createFrame()
local aTextfield = mainFrame:addTextfield()
-- Assume the Textfield has been scrolled previously
local xOffset, yOffset = aTextfield:getOffset()
basalt.debug("Horizontal Offset: "..xOffset)
basalt.debug("Vertical Offset: "..yOffset)
basalt.autoUpdate()
```

View File

@@ -0,0 +1,10 @@
## setSelection
### Description
Returns the colors when selecting a text.
### Returns
1. `number|color` foreground color - The text color.
2. `number|color` background color - ´The background color.

View File

@@ -0,0 +1,28 @@
## removeRule
### Description
Removes an existing rule for special coloring in a Textfield object. This allows you to remove the coloring applied to text matching a specific pattern.
### Parameteres
1. `string` pattern - The Lua pattern used to match the text for which the rule was applied.
### Returns
1. `object` The object in use
### Usage
* Removes the rule for coloring all numbers in a Textfield object
```lua
local basalt = require("basalt")
local mainFrame = basalt.createFrame()
local aTextfield = mainFrame:addTextfield()
aTextfield:removeRule("%d") -- Removes the rule for coloring numbers
basalt.autoUpdate()
```

View File

@@ -0,0 +1,28 @@
## setOffset
### Description
Sets the offset within a Textfield object, allowing you to adjust the viewable portion of the text.
### Parameteres
1. `number` xOffset - The horizontal offset to set within the Textfield
2. `number` yOffset - The vertical offset to set within the Textfield
### Returns
1. `object` The object in use
### Usage
```lua
local basalt = require("basalt")
local mainFrame = basalt.createFrame()
local aTextfield = mainFrame:addTextfield()
-- Scroll 10 units down vertically
aTextfield:setOffset(0, 10)
basalt.autoUpdate()
```

View File

@@ -0,0 +1,27 @@
## setSelection
### Description
Changes the color when selecting text.
### Parameteres
1. `number|color` foreground color - The text color.
2. `number|color` background color - ´The background color.
### Returns
1. `object` The object in use
### Usage
```lua
local basalt = require("basalt")
local mainFrame = basalt.createFrame()
local aTextfield = mainFrame:addTextfield()
aTextfield:setSelection(colors.white, colors.blue)
basalt.autoUpdate()
```