diff options
| author | tbfly <[email protected]> | 2018-01-30 11:54:27 +0800 |
|---|---|---|
| committer | tbfly <[email protected]> | 2018-01-30 11:54:27 +0800 |
| commit | b1a7ce3c65c7382904002cb807e8ed5ec6ab513f (patch) | |
| tree | 159edc67380580910e23bc8a77bbcf99e453300c | |
| parent | cebb3b1d1e5c07e0a2c5a9b8f61468e71c6d2f71 (diff) | |
+): Add inputdialog.lua
| -rw-r--r-- | tests/ui/inputdialog.lua | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/tests/ui/inputdialog.lua b/tests/ui/inputdialog.lua new file mode 100644 index 000000000..0fb8ed89f --- /dev/null +++ b/tests/ui/inputdialog.lua @@ -0,0 +1,57 @@ +--!A cross-platform build utility based on Lua +-- +-- Licensed to the Apache Software Foundation (ASF) under one +-- or more contributor license agreements. See the NOTICE file +-- distributed with this work for additional information +-- regarding copyright ownership. The ASF licenses this file +-- to you under the Apache License, Version 2.0 (the +-- "License"); you may not use this file except in compliance +-- with the License. You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- +-- Copyright (C) 2015 - 2018, TBOOX Open Source Group. +-- +-- @author ruki +-- @file inputdialog.lua +-- + +-- imports +import("core.ui.log") +import("core.ui.rect") +import("core.ui.view") +import("core.ui.label") +import("core.ui.event") +import("core.ui.inputdialog") +import("core.ui.application") + +-- the demo application +local demo = application() + +-- init demo +function demo:init() + + -- init name + application.init(self, "demo") + + -- init background + self:background_set("blue") + + -- init input dialog + local dialog_input = inputdialog:new("dialog.input", rect {0, 0, 50, 8}) + dialog_input:text():text_set("please input text:") + dialog_input:button_add("no", "< No >", function (v) dialog_input:quit() end) + dialog_input:button_add("yes", "< Yes >", function (v) dialog_input:quit() end) + self:insert(dialog_input, {centerx = true, centery = true}) +end + +-- main entry +function main(...) + demo:run(...) +end |
