Fix for input field focus
This commit is contained in:
1 parent
5d38b325c5
commit
e49aa9b7d8
3 files changed
+14
-13
No files matched your search
@@ -275,18 +275,22 @@ function OnkeyEvent(key as string, press as boolean) as boolean
|
||||
end function
|
||||
|
||||
function GetFocusedControl() as object
|
||||
focusedChild = m.top.focusedChild
|
||||
if focusedChild = invalid
|
||||
node = m.top.focusedChild
|
||||
if node = invalid
|
||||
return invalid
|
||||
end if
|
||||
|
||||
while not focusedChild.id.StartsWith("Control")
|
||||
focusedChild = focusedChild.focusedChild
|
||||
if focusedChild = invalid
|
||||
while not node.id.StartsWith("Control")
|
||||
child = node.focusedChild
|
||||
if child = invalid
|
||||
return invalid
|
||||
end if
|
||||
if node.isSameNode(child)
|
||||
return invalid
|
||||
end if
|
||||
node = child
|
||||
end while
|
||||
return focusedChild
|
||||
return node
|
||||
end function
|
||||
|
||||
function MenuGoLeft() as boolean
|
||||
@@ -299,6 +303,9 @@ end function
|
||||
|
||||
function MenuNavigate(direction as integer) as boolean
|
||||
focusedControl = GetFocusedControl()
|
||||
if focusedControl = invalid
|
||||
return false
|
||||
end if
|
||||
container = focusedControl.getParent()
|
||||
containerParent = container.getParent()
|
||||
containerCount = containerParent.getChildCount()
|
||||
|
||||
@@ -3,7 +3,6 @@ function Init()
|
||||
m.top.observeField("focusedChild", "OnFocusChanged")
|
||||
m.top.observeField("value", "OnValueChanged")
|
||||
m.top.observeField("settings", "OnSettingsScreen")
|
||||
m.keyboardWasClosedByButton = false
|
||||
end function
|
||||
|
||||
function OnSettingsScreen()
|
||||
@@ -45,15 +44,9 @@ function OnButtonSelected(event as object)
|
||||
if buttonSelected = 0
|
||||
m.top.value = keyboard.text
|
||||
end if
|
||||
m.keyboardWasClosedByButton = true
|
||||
keyboard.close = true
|
||||
end function
|
||||
|
||||
function OnKeyboardClosed() as void
|
||||
' The keyboard was closed by something else (like cast from web app)
|
||||
' In this case, we do nothing, since the focus might be moved to the video player
|
||||
if not m.keyboardWasClosedByButton
|
||||
return
|
||||
end if
|
||||
m.top.settings@.MenuNavigate(-1)
|
||||
end function
|
||||
Reference in new issue
Block a user