2023-07-02 00:59:02 +02:00
# Class: tab
Class for representing a tab within the GUI.
2023-07-19 09:28:22 +02:00
## Functions (12)
### `is_selected()`
- **Returns:**
2023-07-21 21:21:51 +02:00
- `boolean` : Returns true if this tab is the one currently selected in the GUI.
2023-07-19 09:28:22 +02:00
**Example Usage:**
```lua
boolean = tab:is_selected()
```
2023-07-05 00:30:57 +02:00
### `clear()`
Clear the tab of all its custom lua content that you own.
**Example Usage:**
```lua
tab:clear()
```
### `add_tab()`
Add a sub tab to this tab.
**Example Usage:**
```lua
tab:add_tab()
```
2023-07-02 00:59:02 +02:00
### `add_button(name, callback)`
Add a button to the gui tab.
- **Parameters:**
- `name` (string): Text written inside the button.
- `callback` (function): function that will be called when the button is clicked.
2023-07-05 00:30:57 +02:00
**Example Usage:**
2023-07-02 00:59:02 +02:00
```lua
tab:add_button(name, callback)
```
### `add_text(name)`
Add text to the gui tab.
- **Parameters:**
- `name` (string): Text that will be written.
- **Returns:**
- `text` : The text object instance.
2023-07-05 00:30:57 +02:00
**Example Usage:**
2023-07-02 00:59:02 +02:00
```lua
text = tab:add_text(name)
```
### `add_checkbox(name)`
Add a checkbox widget to the gui tab.
- **Parameters:**
- `name` (string): Text that will be written next to the checkbox.
- **Returns:**
- `checkbox` : The checkbox object instance.
2023-07-05 00:30:57 +02:00
**Example Usage:**
2023-07-02 00:59:02 +02:00
```lua
checkbox = tab:add_checkbox(name)
```
### `add_sameline()`
Add a ImGui::SameLine.
- **Returns:**
- `sameline` : The sameline object instance.
2023-07-05 00:30:57 +02:00
**Example Usage:**
2023-07-02 00:59:02 +02:00
```lua
sameline = tab:add_sameline()
```
### `add_separator()`
Add a ImGui::Separator.
- **Returns:**
- `separator` : The separator object instance.
2023-07-05 00:30:57 +02:00
**Example Usage:**
2023-07-02 00:59:02 +02:00
```lua
separator = tab:add_separator()
```
### `add_input_int(name)`
Add a ImGui::InputInt.
- **Parameters:**
- `name` (string): Text that will be written next to the input field.
- **Returns:**
- `input_int` : The input_int object instance.
2023-07-05 00:30:57 +02:00
**Example Usage:**
2023-07-02 00:59:02 +02:00
```lua
input_int = tab:add_input_int(name)
```
### `add_input_float(name)`
Add a ImGui::InputFloat.
- **Parameters:**
- `name` (string): Text that will be written next to the input field.
- **Returns:**
- `input_float` : The input_float object instance.
2023-07-05 00:30:57 +02:00
**Example Usage:**
2023-07-02 00:59:02 +02:00
```lua
input_float = tab:add_input_float(name)
```
### `add_input_string(name)`
Add a ImGui::InputText.
- **Parameters:**
- `name` (string): Text that will be written next to the input field.
- **Returns:**
- `input_string` : The input_string object instance.
2023-07-05 00:30:57 +02:00
**Example Usage:**
2023-07-02 00:59:02 +02:00
```lua
input_string = tab:add_input_string(name)
```
2023-07-17 14:55:42 +02:00
### `add_imgui(imgui_rendering)`
Registers a function that will be called every rendering frame, you can call ImGui functions in it, please check the ImGui.md documentation file for more info.
**Example Usage:**
```lua
tab:add_imgui(function()
if ImGui.Begin("My Custom Window") then
if ImGui.Button("Label") then
script.run_in_fiber(function(script)
-- call natives in there
end)
end
ImGui.End()
end
end)
```
- **Parameters:**
- `imgui_rendering` (function): Function that will be called every rendering frame, you can call ImGui functions in it, please check the ImGui.md documentation file for more info.
**Example Usage:**
```lua
tab:add_imgui(imgui_rendering)
```
2023-07-02 00:59:02 +02:00