-
Notifications
You must be signed in to change notification settings - Fork 1
Button
GNamimates edited this page Oct 30, 2024
·
4 revisions
an element that allows the user to click on it.
Quick example on making a button and doing something when clicking it.
local GNUI = require"GNUI.main"
local Button = require"GNUI.element.button"
local screen = GNUI.getScreenCanvas()
local btn = Button.new(screen)
---@type GNUI.InputEvent
btn.PRESSED:register(function ()
-- clicked
end)| Type | Field | Description | |
|---|---|---|---|
GNUI.Box |
HoverBox | ... | |
boolean |
isPressed | ... | |
boolean |
isToggle | ... | |
GNUI.keyCode |
keybind | ... |
| Event | Description |
|---|---|
BUTTON_CHANGED |
... |
BUTTON_DOWN |
... |
BUTTON_UP |
... |
PRESSED |
... |
| Returns | Methods |
|---|---|
GNUI.Button |
Button.new(parent : GNUI.Box?, variant : string|"none"|"default"?) |
self |
Button:setToggle(toggle : boolean) |
self |
Button:press() |
self |
Button:click() |
self |
Button:release() |
-
GNUI.Box?parent -
string|"none"|"default"?variant
Sets whether the button is toggleable
-
booleantoggle
Presses the button. or if the button is a toggle and is pressed, this releases the button.
Presses and releases the button.
Releases the button, if the button is not a toggle, if it is, call press() again to release.