diff --git a/Zframework/scene.lua b/Zframework/scene.lua index b0d8be06..3bcd2e4e 100644 --- a/Zframework/scene.lua +++ b/Zframework/scene.lua @@ -56,7 +56,6 @@ end function SCN.init(s,org) local S=scenes[s] SCN.cur=s - WIDGET.set(s) SCN.sceneInit=S.sceneInit SCN.sceneBack=S.sceneBack @@ -76,8 +75,8 @@ function SCN.init(s,org) SCN.gamepadDown=S.gamepadDown SCN.gamepadUp=S.gamepadUp SCN.socketRead=S.socketRead - if S.sceneInit then S.sceneInit(org)end + WIDGET.set(s) end function SCN.push(tar,style) if not SCN.swapping then diff --git a/parts/scenes/chat.lua b/parts/scenes/chat.lua index 19405a5d..67ac8d05 100644 --- a/parts/scenes/chat.lua +++ b/parts/scenes/chat.lua @@ -10,6 +10,10 @@ local scroll--Bottom message no. local newMessasge=false--If there is a new message local heartBeatTimer +local function focusAtTextbox() + coroutine.yield() + WIDGET.sel=WIDGET.active.text +end local function sendMessage() local W=WIDGET.active.text if #W.value>0 and wsWrite(W.value)then @@ -38,7 +42,7 @@ function scene.sceneInit() scroll=scroll+1 end end - WIDGET.sel=WIDGET.active.text + TASK.new(focusAtTextbox)--Widgets are not initialized, so active after 1 frame BG.set("none") wsConnect( TICK.wsCONN_connect,