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.
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.
local dialog1 = gui.DialogWidget("Dialog1", mainWindow)
local dialog1 = CreateDialogWidget("Dialog1")
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.
local angle1 = gui.AngleGUI("AngleWidget") dialog1:addWidget("angle1", angle1)
Returns a list of all input widgets present in the dialog widget.
local guiwidgets = dialog1:inputWidgets()
Get and set title for the dialog widget
message(dialog1:title())
dialog1:setTitle("New Dialog")
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.
dialog1:setFinishButton(button1)
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.
dialog1:addFinishCallback(function(valTable) for k,v in pairs(valTable) do message(tostring(k) .. tostring(v)) end end)
Returns a list of keys of all the input gui widgets in the dialog.
local keyList = dialog1:keys()