User Tools

Site Tools


Sidebar

Introduction

* Home

Documentation & help

LibreCAD Community

Help on DokuWiki

Temporary shorcuts

dev:v3:gui_api:dialog:dialogwidget

Dialog Widget Class

Github Link

 namespace lc::ui::api 

A Dialog widget object acts a parent widget containing all the input gui widgets. A finish button can be added which on being clicked retrieves the values of all the input guis in a table when the user is finished with the dialog. This table is passed in as a parameter to all the finish callbacks added to the dialog widget.


Constructor


Description

Constructs a dialog widget object. This dialog widget contains all the input gui widgets. The constructor takes in a label and a mainwindow pointer as parameters. Can be constructed using the

 CreateDialogWidget("DialogLabel") 

which takes care of passing in the mainwindow as parameter.

  • Dialog Label - string , Current MainWindow - MainWindow

Examples

  •  local dialog1 = gui.DialogWidget("Dialog1", mainWindow) 
  •  local dialog1 = CreateDialogWidget("Dialog1") 

Add Input GUI Widget


Description

Add an input gui widget to the dialog widget. Expects a key and input widget as parameters. Key is used to retrieve the value of the input gui widget.

Note:- If button or checkbox is added, the addWidget function first adds it to a horizontal group gui widget which is then added to the dialog widget.

  • Key - string , Input GUI Widget - InputGUI

Examples

  •  local angle1 = gui.AngleGUI("AngleWidget")
     dialog1:addWidget("angle1", angle1) 

Get list of input widgets


Description

Returns a list of all input widgets present in the dialog widget.

Examples

  •  local guiwidgets = dialog1:inputWidgets() 

Title


Description

Get and set title for the dialog widget

Examples

  •  message(dialog1:title()) 
  •  dialog1:setTitle("New Dialog")

Set Finish Button


Description

Set a button as the finish button for the dialog widget which on being clicked will return a table of all values to all the finish lua callbacks added to the dialog widget.

  • Finish button - ButtonGUI

Examples

  •  dialog1:setFinishButton(button1) 

Add Finish Callback


Description

Add a finish callback which is called whenever the user is done with the dialog and clicks on the finish button. The callback is passed in a table containing the key and value of all the input gui widgets.

  • Lua Callback - kaguya::LuaRef

Examples

  •  dialog1:addFinishCallback(function(valTable) for k,v in pairs(valTable) do message(tostring(k) .. tostring(v)) end end) 

Get keys


Description

Returns a list of keys of all the input gui widgets in the dialog.

Examples

  •  local keyList = dialog1:keys() 

dev/v3/gui_api/dialog/dialogwidget.txt · Last modified: 2020/07/09 04:46 by jedi18