add show_checkbox_dialog

This commit is contained in:
Evgeny
2021-08-28 09:18:39 +03:00
parent 5adc9e7d84
commit 6714963c60
4 changed files with 32 additions and 6 deletions

View File

@@ -7,10 +7,20 @@ function on_click()
ui:show_checkbox_dialog("Title", dialog_items, 2)
end
function on_dialog_action(idx)
if idx == -1 then
function on_dialog_action(tab)
if tab == -1 then
ui:show_toast("Dialog cancelled")
else
ui:show_toast("Checked: "..dialog_items[idx])
ui:show_toast("Checked: "..table_to_string(tab))
end
end
function table_to_string(tab)
local s = ""
for k, v in ipairs(tab) do
s = s..v.." "
end
return s
end

View File

@@ -0,0 +1,16 @@
function on_resume()
ui:show_text("Open dialog")
end
function on_click()
dialog_items = { "One", "Two", "Three" }
ui:show_radio_dialog("Title", dialog_items, 2)
end
function on_dialog_action(idx)
if idx == -1 then
ui:show_toast("Dialog cancelled")
else
ui:show_toast("Choosen: "..dialog_items[idx])
end
end