升级控件模块,封装focus相关的几个静态方法

This commit is contained in:
MrZ626
2021-05-15 23:32:14 +08:00
parent 4606bb4d01
commit 9bec223b09
11 changed files with 37 additions and 33 deletions

View File

@@ -677,8 +677,7 @@ userG.the_box=first_box
local scene={}
function scene.sceneInit()
TASK.new(function()YIELD()WIDGET.sel=inputBox end)
enableTextInput()
TASK.new(function()WIDGET.focus(inputBox)end)
BG.set('none')
end
@@ -780,13 +779,13 @@ function scene.keyDown(k)
elseif combKey[k]and kb.isDown("lctrl","rctrl")then
combKey[k]()
elseif k=="escape"then
if WIDGET.sel~=inputBox then
WIDGET.sel=inputBox
if not WIDGET.isFocus(inputBox)then
WIDGET.focus(inputBox)
else
SCN.back()
end
else
if WIDGET.sel~=inputBox then WIDGET.sel=inputBox end
if not WIDGET.isFocus(inputBox)then WIDGET.focus(inputBox)end
WIDGET.keyPressed(k)
end
end