Files
Basalt/docs/objects/VisualObject/setVisible.md
Robert Jelic bb1b1beb79 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
2023-04-30 17:05:34 +02:00

29 lines
864 B
Markdown

## setVisible
### Description
The `setVisible` method allows you to control the visibility of an object directly by passing a boolean value (true for visible, false for hidden).
### Returns
1. `boolean` The visibility state of the object (true for visible, false for hidden)
### Usage
* Toggle visibility of a button:
```lua
local basalt = require("basalt")
local mainFrame = basalt.createFrame()
local button = mainFrame:addButton():setText("Toggle")
local anotherButton = mainFrame:addButton():setText("Another Button")
button:onClick(function()
local currentState = anotherButton:isVisible()
anotherButton:setVisible(not currentState)
end)
```
In this example, a button is added to the mainFrame with the text "Toggle". When clicked, the setVisible method is called on anotherButton, toggling its visibility between hidden and visible states.