实例代码 - 一行显示多个控件

该代码中的部分新参数最低支持安卓 v3.2.0, iOS v3.1.5 版本。

local ts = require("ts")
local cjson = ts.json
w,h = getScreenSize();
MyTable = {
    ["style"]  = "default",    
    ["width"] = w,          
    ["height"] = h,            
    ["cancelname"] = "取消",  
    ["okname"] = "开始", 
    ["title"] = "居中自定义字号",
    ["titlealign"] = "center",
    ["align"] = "center",
    ["titlesize"] = 12,  
    ["titles"] = "第一页,标签页,新增属性,左右滑动,切换页面", 
    ["pagetype"]= "multi",  
    ["selpage"] = 1,   
    ["orient"] = 0, 
    ["btnbkcolor"] = "255,255,255",         
    ["bgcolor"] = "255,255,255",
    ["pagenumtype"] = "tab", 
    ["config"] = "showuiTest1.txt",  
    ["timer"] = 99,  
    ["rettype"] = "table",   
    pages            =
    {
        {
            {
                ["type"] = "Label", 
                ["text"] = "上线日期:",        
                ["size"] = 12, 
                ["align"] = "left",          
                ["valign"] = "top", 
                ["color"] = "0,0,0",           
                ["width"] = -1,
                ["nowrap"] = 1,--下个控件不换行
            },
            {
                ["type"] = "Edit",               
                ["id"] = "year",                  
                ["prompt"] = "年",  
                ["text"] = "2014",     
                ["kbtype"] = "number",  
                ["color"] = "0,0,0",   
                ["size"] = 12,           
                ["align"] = "center",           
                ["valign"] = "top",   
                ["width"] = 180,
                ["nowrap"] = 1,--下个控件不换行
            },
            {
                ["type"] = "Label", 
                ["text"] = "年",        
                ["size"] = 12, 
                ["align"] = "left",          
                ["valign"] = "top", 
                ["color"] = "0,0,0",           
                ["width"] = -1,
                ["nowrap"] = 1,--下个控件不换行
            },
            {
                ["type"] = "Edit",               
                ["id"] = "month",                  
                ["prompt"] = "月",  
                ["text"] = "5",     
                ["kbtype"] = "number",  
                ["color"] = "0,0,0",   
                ["size"] = 12,           
                ["align"] = "center",--输入框文字水平对齐方式           
                ["valign"] = "top", --输入框垂直对齐方式  
                ["width"] = 120,
                ["nowrap"] = 1,--下个控件不换行
            },
            {
                ["type"] = "Label",            
                ["text"] = "月",        
                ["size"] = 12,                 
                ["align"] = "left",           
                ["valign"] = "top", 
                ["color"] = "0,0,0",    
                ["width"] = -1,
                ["nowrap"] = 1,--下个控件不换行
            },
            {
                ["type"] = "Edit",               
                ["id"] = "day",                  
                ["prompt"] = "日",  
                ["text"] = "1",     
                ["kbtype"] = "number",  
                ["color"] = "0,0,0",   
                ["size"] = 12,           
                ["align"] = "center",           
                ["valign"] = "top",   
                ["width"] = 120,
                ["nowrap"] = 1,--下个控件不换行
            },
            {
                ["type"] = "Label",        
                ["text"] = "日",        
                ["size"] = 12,                  
                ["align"] = "left",           
                ["valign"] = "top", 
                ["color"] = "0,0,0",           
                ["width"] = -1,
                --["nowrap"] = 1,
            },      
        }
    }   
}
local MyJsonString = cjson.encode(MyTable);
UIret,values = showUI(MyJsonString)
if UIret == 1 then
    local year =  values.year
    local month =  values.month
    local day =  values.day
    dialog("上线日期:"..year.." 年 "..month.."  月"..day.." 日")
end
Copyright 北京帮你玩科技有限公司 2020 all right reserved,powered by Gitbook该文章修订时间: 2020-09-27 12:37:30

results matching ""

    No results matching ""