Button

The button, one of the mostly used widget in any Graphical User Interface (GUI). You can label it with text or even include icons to make it more visually informative. It’s commonly used to trigger actions or functions within an application when clicked.

local button = Button(text)

This is done by calling a callback function after clicking on a button. You can specify such a callback function with the setOnClick method

1button:setOnClick(function(sender)
2  -- some task here
3end)

Properties

setOnClick(callback)

The function executed when the button is clicked

setIcon(path)

Sets an icon on the button

checkout Using resources

setIconSize(width, height)

Resizes the icon set in the button

setText(text)

Sets text on the button

getText()

Returns text on the button

setFlat()

Makes the button appear flat

setCheckable(checkable: bool)

Set whether or not the button can be checked/toggled

isChecked()

Return the check/toggle status of the button

setMenu(menu)

Sets menu to the button

setMargins(left, top, right, bottom)

Sets the margins of the button

checkout working with menus