Constructs a toolbar button gui object. Button after being constructed needs to be added to a group for it to be visible in the application.
local button1 = gui.ToolbarButton("Button1", "icon_path", function() message("Test") end)
local button1 = gui.ToolbarButton("Button1", "icon_path")
local button1 = gui.ToolbarButton("Button1", "icon_path", function() message("Test") end), "Tooltip", true)
Add lua function callback to be called when the toolbar button is clicked. Multiple callbacks can be added. Callbacks can also be named callbacks i.e. associated with a name so that it can be later removed by use of the name.
button1:addCallback(function() run_command("LINE") end)
button1:addCallback("message_callback", function() message("Test") end)
Remove lua function called associated with the given name. Only named callbacks can be removed.
button1:removeCallback("message_callback")
Set the tooltip for the button.
button1:setTooltip("New Tooltip")
Get and set label for the toolbar button.
message(button1:label())
button1:setLabel("New Button")
Enable or disable the toolbar button.
button1:enable()
button1:disable()
Hide or show the toolbar button.
button1:hide()
button1:show()
Remove the current toolbar button from the group.
button1:remove()
Return if the button is checkable or not.
local isCheckable = button1:checkable()