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,6 +1,6 @@
|
||||
The button object is for creating buttons If you click on them, they should execute something. You decide what should happen when clicking on them.
|
||||
The Button object is derived from the VisualObject class and is used for creating interactive buttons in the Basalt framework. When a button is clicked, it can execute a predefined function, such as navigating to another screen or performing a specific action.
|
||||
|
||||
[Object](objects/Object.md) methods also apply for buttons.
|
||||
In addition to the Object and VisualObject methods, buttons also have the following methods:
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
@@ -8,9 +8,10 @@ The button object is for creating buttons If you click on them, they should exec
|
||||
|[setHorizontalAlign](objects/Button/setHorizontalAlign.md)|Changes the horizontal text position
|
||||
|[setVerticalAlign](objects/Button/setVerticalAlign.md)|Changes the vertical text position
|
||||
|
||||
|
||||
# Example
|
||||
This is a example on how you would create a fully working button:
|
||||
|
||||
Here's an example of how to create a fully functional button using the Button object:
|
||||
|
||||
```lua
|
||||
local main = basalt.createFrame()
|
||||
local aButton = main:addButton():setText("Click")
|
||||
@@ -22,16 +23,16 @@ aButton:onClick(function(self,event,button,x,y)
|
||||
end)
|
||||
```
|
||||
|
||||
and this would be the xml way:
|
||||
```lua
|
||||
basalt.setVariable("buttonClick", function(self,event,button,x,y)
|
||||
if(event=="mouse_click")and(button==1)then
|
||||
basalt.debug("Left mousebutton got clicked!")
|
||||
end
|
||||
end)
|
||||
Alternatively, you can create a button using an XML layout:
|
||||
|
||||
local main = basalt.createFrame():addLayout("example.xml")
|
||||
```
|
||||
```xml
|
||||
<button onClick="buttonClick" text="Click" />
|
||||
```
|
||||
<button onClick="buttonClick" text="Click">
|
||||
<onClick>
|
||||
if(event=="mouse_click")and(button==1)then
|
||||
basalt.debug("Left mousebutton got clicked!")
|
||||
end
|
||||
</onClick>
|
||||
</button>
|
||||
```
|
||||
|
||||
In these examples, a button is created with the text "Click". When the left mouse button is clicked on the button, the message "Left mouse button got clicked!" is printed.
|
||||
|
||||
Reference in New Issue
Block a user