summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2018-01-17 09:41:34 +0800
committerruki <[email protected]>2018-01-17 09:41:34 +0800
commit181b4b1f01ad27978ada93e9627f76f012b0ef12 (patch)
tree03f6ca44330da6eafe36ab2a34f3352ab9020def
parentd729a22336476e0b8de653d83d0f0bfe7d7b172e (diff)
add help dialog
-rw-r--r--tests/ui/dialog.lua7
1 files changed, 6 insertions, 1 deletions
diff --git a/tests/ui/dialog.lua b/tests/ui/dialog.lua
index af9cd0f61..f662625dc 100644
--- a/tests/ui/dialog.lua
+++ b/tests/ui/dialog.lua
@@ -44,12 +44,17 @@ function demo:init()
-- init background
self:background_set("blue")
+ -- init help dialog
+ local dialog_help = textdialog:new("dialog.help", rect {1, 1, self:width() - 1, self:height() - 1}, "README")
+ dialog_help:text():text_set(io.readfile(path.join(os.scriptdir(), "dialog.lua")))
+ dialog_help:button_add("exit", "< Exit >", function (v, e) self:remove(dialog_help) end)
+
-- init main dialog
local dialog_main = boxdialog:new("dialog.main", rect {1, 1, self:width() - 1, self:height() - 1}, "main dialog")
dialog_main:text():text_set("The project focuses on making development and building easier and provides many features (.e.g package, install, plugin, macro, action, option, task ...), so that any developer can quickly pick it up and enjoy the productivity boost when developing and building project.")
dialog_main:button_add("ok", "< OK >", function (v, e) self:view("dialog.hello"):show(true, {focused = true}) end)
dialog_main:button_add("cancel", "< Cancel >", "cm_cancel")
- dialog_main:button_add("help", "< Help >", "cm_help")
+ dialog_main:button_add("help", "< Help >", function (v, e) self:insert(dialog_help) end)
dialog_main:button_add("quit", "< Quit >", "cm_quit")
self:insert(dialog_main)