summaryrefslogtreecommitdiff
path: root/tests/ui
diff options
context:
space:
mode:
authorruki <[email protected]>2018-01-18 23:14:40 +0800
committerruki <[email protected]>2018-01-18 13:28:01 +0800
commit7d42cff795e9600a837fc0e595baa4d76ac0838e (patch)
tree2204f7beacf64ecdb488daea5dfa831ccad3303a /tests/ui
parentc4bdc1b82cc058e29eb3dc9ad335fdc6333e465e (diff)
add textedit
Diffstat (limited to 'tests/ui')
-rw-r--r--tests/ui/dialog.lua33
1 files changed, 24 insertions, 9 deletions
diff --git a/tests/ui/dialog.lua b/tests/ui/dialog.lua
index f662625dc..9e4d601c1 100644
--- a/tests/ui/dialog.lua
+++ b/tests/ui/dialog.lua
@@ -30,6 +30,7 @@ import("core.ui.label")
import("core.ui.event")
import("core.ui.boxdialog")
import("core.ui.textdialog")
+import("core.ui.inputdialog")
import("core.ui.application")
-- the demo application
@@ -52,19 +53,33 @@ function demo:init()
-- 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("tips", "< Tips >", function (v, e) self:view("dialog.tips"):show(true, {focused = true}) end)
+ dialog_main:button_add("input", "< Input >", function (v, e) self:view("dialog.input"):show(true, {focused = true}) end)
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)
- -- init hello dialog
- local dialog_hello = textdialog:new("dialog.hello", rect {0, 0, 50, 8}):background_set(dialog_main:frame():background())
- dialog_hello:frame():background_set("cyan")
- dialog_hello:text():text_set("hello xmake! (http://xmake.io)\nA cross-platform build utility based on Lua"):textattr_set("red")
- dialog_hello:button_add("yes", "< Yes >", function (v, e) dialog_hello:show(false) end)
- dialog_hello:button_add("no", "< No >", function (v, e) dialog_hello:show(false) end)
- self:insert(dialog_hello, {centerx = true, centery = true})
+ -- init tips dialog
+ local dialog_tips = textdialog:new("dialog.tips", rect {0, 0, 50, 8}):background_set(dialog_main:frame():background())
+ dialog_tips:frame():background_set("cyan")
+ dialog_tips:text():text_set("hello xmake! (http://xmake.io)\nA cross-platform build utility based on Lua"):textattr_set("red")
+ dialog_tips:button_add("yes", "< Yes >", function (v, e) dialog_tips:show(false) end)
+ dialog_tips:button_add("no", "< No >", function (v, e) dialog_tips:show(false) end)
+ self:insert(dialog_tips, {centerx = true, centery = true})
+
+ -- init input dialog
+ local dialog_input = inputdialog:new("dialog.input", rect {0, 0, 50, 8}):background_set(dialog_main:frame():background())
+ dialog_input:frame():background_set("cyan")
+ dialog_input:text():text_set("please input text:"):textattr_set("red")
+ dialog_input:button_add("no", "< No >", function (v, e) dialog_input:show(false) end)
+ dialog_input:button_add("yes", "< Yes >", function (v, e)
+ dialog_main:text():text_set(dialog_input:textedit():text())
+ dialog_input:show(false)
+ end)
+ self:insert(dialog_input, {centerx = true, centery = true})
+
+ -- TODO
+-- dialog_input:show(false)
end
-- main entry