Add a checkbox group (:add_checkbox)
Declaration
dialog_obj = dialog_obj:add_checkbox(label, options [, default_options])
Parameters
- label
String. The title text for the checkbox group - options
Table. Ordered list of option names in the group; names must be unique - default_options
Table, optional. Default selected option names. Default:
Returns
- dialog_obj
Dialog. Returns the dialog itself - :show() return type
Table. An ordered list containing all selected option names
Description
Add a checkbox group to the dialog
Example
local c, s = dialog()
:add_checkbox('A checkbox group', {'Option1', 'Option2', 'Option3', 'Option4'}, {'Option1', 'Option3'})
:show()
print('Selected count: ' .. #(s['A checkbox group']))
print('Selected list:')
for _, oname in ipairs(s['A checkbox group']) do
print(oname)
end
sys.alert(print.out())
Note: Uses functions outside this chapter sys.alert
, print
, print.out
Full example
See :show()