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
This commit is contained in:
@@ -1,20 +1,36 @@
|
||||
## addRule
|
||||
Adds a new rule for special coloring
|
||||
|
||||
#### Parameteres:
|
||||
1. `string` a pattern - check out this page: (https://riptutorial.com/lua/example/20315/lua-pattern-matching)
|
||||
2. `number|color` text color
|
||||
3. `number|color` background color - optional
|
||||
### Description
|
||||
|
||||
Adds a new rule for special coloring in a Textfield object. This allows you to apply a specific color and/or background color to text matching a provided pattern.
|
||||
|
||||
### Parameteres
|
||||
|
||||
1. `string` pattern - A Lua pattern for matching the text you want to color. You can find more information about Lua patterns [here](https://riptutorial.com/lua/example/20315/lua-pattern-matching).
|
||||
2. `number|color` textColor - The color you want to apply to the text matching the pattern
|
||||
3. `number|color` backgroundColor - (optional) The background color you want to apply to the text matching the pattern
|
||||
|
||||
### Returns
|
||||
|
||||
#### Returns:
|
||||
1. `object` The object in use
|
||||
|
||||
#### Usage:
|
||||
* Changes the color of all numbers
|
||||
### Usage
|
||||
|
||||
* Changes the color of all numbers in a Textfield object
|
||||
|
||||
```lua
|
||||
local basalt = require("basalt")
|
||||
|
||||
local mainFrame = basalt.createFrame()
|
||||
local aTextfield = mainFrame:addTextfield():addRule("%d", colors.lightBlue)
|
||||
local aTextfield = mainFrame:addTextfield()
|
||||
|
||||
aTextfield:addRule("%d", colors.lightBlue)
|
||||
|
||||
basalt.autoUpdate()
|
||||
```
|
||||
|
||||
In this example, a Textfield object is created and added to the mainFrame. The `addRule` method is called to add a rule that highlights all numbers with a light blue color. The pattern used for matching numbers is `%d`.
|
||||
|
||||
```xml
|
||||
<textfield>
|
||||
<rules>
|
||||
@@ -24,4 +40,4 @@ local aTextfield = mainFrame:addTextfield():addRule("%d", colors.lightBlue)
|
||||
</rule>
|
||||
</rules>
|
||||
</textfield>
|
||||
```
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user