summaryrefslogtreecommitdiff
path: root/tests/ui/hello.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2017-12-23 00:50:31 +0800
committerruki <[email protected]>2017-12-22 23:03:10 +0800
commit34df1cdc819a181872aa987c3ea9f2ba0810127c (patch)
treec67838afb8a9ebc914ebb29407b365d51f037cdc /tests/ui/hello.lua
parent8e249fefd8265911fe4fe8ef72e489cbc8e326eb (diff)
add title label to hello demo
Diffstat (limited to 'tests/ui/hello.lua')
-rw-r--r--tests/ui/hello.lua4
1 files changed, 3 insertions, 1 deletions
diff --git a/tests/ui/hello.lua b/tests/ui/hello.lua
index 1691d6aee..b24b70e70 100644
--- a/tests/ui/hello.lua
+++ b/tests/ui/hello.lua
@@ -43,7 +43,9 @@ function hello:init()
self:menubar():title_set("Menu Bar (Hello)")
-- add title label
- self:desktop():insert(label:new("title", rect {0, 1, 20, 2}, "hello xmake!"))
+ local title = "hello xmake!"
+ local pos = (self:width() - #title) / 2
+ self:desktop():insert(label:new("title", rect {pos, 0, pos + #title, 1}, title))
end
-- on event