diff options
| author | ruki <[email protected]> | 2018-01-12 00:39:22 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2018-01-11 21:56:13 +0800 |
| commit | b8276d35af753721b99e893d92485c99e2de111f (patch) | |
| tree | 26f3228f129e671622e10e784aaa00ce85239dde /tests/ui/dialog.lua | |
| parent | 3d4fcf847c7a7f365f84d4c4064597c66e124d4c (diff) | |
add buttons to dialog
Diffstat (limited to 'tests/ui/dialog.lua')
| -rw-r--r-- | tests/ui/dialog.lua | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/tests/ui/dialog.lua b/tests/ui/dialog.lua index 7700eae8c..bf4f0ca0a 100644 --- a/tests/ui/dialog.lua +++ b/tests/ui/dialog.lua @@ -44,10 +44,19 @@ function demo:init() self:background_set("blue") -- init main dialog --- self:insert(dialog:new("dialog.main", rect {1, 1, self:width() - 1, self:height() - 1}, "main dialog")) + local dialog_main = dialog:new("dialog.main", rect {1, 1, self:width() - 1, self:height() - 1}, "main dialog") + dialog_main:button_add("ok", "< OK >", "cm_ok") + dialog_main:button_add("cancel", "< Cancel >", "cm_cancel") + dialog_main:button_add("help", "< Help >", "cm_help") + dialog_main:button_add("quit", "< Quit >", "cm_quit") + self:insert(dialog_main) -- init hello dialog - self:insert(dialog:new("dialog.hello", rect {0, 0, self:width() / 2, self:height() / 4}), {centerx = true, centery = true}) + local dialog_hello = dialog:new("dialog.hello", rect {0, 0, self:width() / 2, self:height() / 4}):background_set(dialog_main:frame():background()) + dialog_hello:frame():background_set("green") + dialog_hello:button_add("yes", "< Yes >", "cm_yes") + dialog_hello:button_add("no", "< No >", "cm_no") + self:insert(dialog_hello, {centerx = true, centery = true}) end -- main entry |
