问题1: 用线程阻塞的办法,动态UI在界面点击继续之后,ui.getData() 参数返回值为空
ui.newLayout("layout1")
ui.newRow("layout1","row1")
ui.addEditText("layout1","editId1","中国牛逼")
ui.newRow("layout1","row2")
ui.loadProfile("/sdcard/myui.txt")
ui.setOnClose("layout1","onClose()")
function onClose()
ui.saveProfile("/sdcard/myui.txt")
close = true
end
close = false
ui.show("layout1")
while close == false do
sleep(500)
end
print("ui data==",ui.getData())
问题2:同样是使用阻塞线程的办法,添加一个Button开关闭布局窗口,返回值还是空的
ui.newLayout("layout1")
ui.newRow("layout1","row1")
ui.addEditText("layout1","editId1","中国牛逼")
ui.newRow("layout1","row2")
ui.addButton("layout1","btnnId1","开始运行")
ui.loadProfile("/sdcard/myui.txt")
ui.setOnClick("btnnId1","onClick()")
close = false
function onClick()
ui.saveProfile("/sdcard/myui.txt")
ui.dismiss("layout1")
close = true
end
ui.show("layout1",false)
while close == false do
sleep(500)
end
print("ui data==",ui.getData())
只有当主线程主动关闭布局,才能取到返回值。请问下上面异步关闭窗口有什么办法可以获取到返回值,并且可以在后续的代码修改UI配置
ui.newLayout("layout1")
ui.newRow("layout1","row1")
ui.addEditText("layout1","editId1","中国牛逼")
ui.newRow("layout1","row2")
ui.addButton("layout1","btnnId1","开始运行")
ui.loadProfile("/sdcard/myui.txt")
ui.show("layout1",false)
sleep(1000)
ui.saveProfile("/sdcard/myui.txt")
print("ui data==",ui.getData())
|