User Tools

Site Tools


Sidebar

Introduction

* Home

Documentation & help

LibreCAD Community

Help on DokuWiki

Temporary shorcuts

dev:v3:gui_api:toolbar:toolbarbutton

This is an old revision of the document!


Toolbar Button GUI Class

Github Link

 namespace lc::ui::api 

Toolbar Button Constructor


Description

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.

  • Toolbar Button Name - string , Icon Path - string , Lua Callback - kaguya::LuaRef , Tooltip(Default = “”) - string , Checkable(Default = false) - bool
  • Toolbar Button Name - string , Icon Path - string , Tooltip(Default = “”) - string , Checkable(Default = false) - bool

Examples

  •  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 Button


Description

Add Toolbar Button to the group of the given name and icon or by pointer to existing toolbar group. Toolbar button callback can also be passed in.

  • Toolbar Button Label - string , Icon path - string
    • returns ToolbarButton
  • Toolbar Button Label - string , Icon path - string , Lua Callback - kaguya::LuaRef
    • returns ToolbarButton
  • Pointer to Toolbar Button - ToolbarButton

Examples

  •  local button1 = group1:addButton("Button1", "path_to_icon") 
  •  local button1 = group1:addButton("Button1", "path_to_icon", function() message("Button clicked") end) 
  •  local button1 = gui.ToolbarButton("Button1", "path_to_icon")
     group1:addButton(button1)

Label


Description

Get and set label for the toolbar button.

Examples

  •  message(button1:label()) 
  •  button1:setLabel("New Button")

Enable and Disable


Description

Enable or disable the toolbar button.

Examples

  •  button1:enable() 
  •  button1:disable() 

Hide and Show


Description

Hide or show the toolbar group.

Examples

  •  button1:hide() 
  •  button1:show() 

Remove


Description

Remove the current toolbar button from the group.

Examples

  •  button1:remove() 

Checkable


Description

Return if the button is checkable or not.

Examples

  •  local isCheckable = button1:checkable() 

dev/v3/gui_api/toolbar/toolbarbutton.1594112504.txt.gz · Last modified: 2020/07/07 09:01 by jedi18