- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am developing my first Roku channel and facing an issue with focus management. I have a simple scene with two TextEditBox elements for Display ID and PIN, a Button, and a Label for error messages. The problem is that only the button seems to be receiving focus and working as expected. When I press the "Up" button on the remote, the focus index changes (as confirmed by debug statements), but the TextEditBox elements do not receive focus, and the on-screen keyboard does not appear.
Code Snippets:
helloworld.xml:
helloworld.brs:
Troubleshooting Steps Taken:
- Set focusable="true" for TextEditBox and Button.
- Used observeField to listen for button clicks.
- Added debug statements to confirm focus index changes.
Questions:
- How can I ensure that the TextEditBox elements receive focus?
- Why is the on-screen keyboard not appearing for TextEditBox elements?
- Is there anything wrong with my focus management logic?
Any help would be greatly appreciated!
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This isn't directly answering your question, but if you're expecting a keyboard to appear automatically when the TextEditBox is focused, you'll be disappointed.
The way I tend to handle these forms is to display the field contents on buttons (disguised/extended to look like text inputs), then when these are selected I pop up an overlay containing a Keyboard (or DynamicKeyboard/etc as cert requriments + functionality demand) to do the actual text entry. An "OK" button dismisses the keyboard and I populate the button with the updated text. A "StandardKeyboardDialog" could work if you don't have a fussy designer involved.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This isn't directly answering your question, but if you're expecting a keyboard to appear automatically when the TextEditBox is focused, you'll be disappointed.
The way I tend to handle these forms is to display the field contents on buttons (disguised/extended to look like text inputs), then when these are selected I pop up an overlay containing a Keyboard (or DynamicKeyboard/etc as cert requriments + functionality demand) to do the actual text entry. An "OK" button dismisses the keyboard and I populate the button with the updated text. A "StandardKeyboardDialog" could work if you don't have a fussy designer involved.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Focus Management Issue in Roku Channel - TextEditBox Not Receiving Focus
Oh, also - maybe more useful:
Try
m.top.observeField("focusedChild", "onFocusedChildChanged")
...that should call a function whenever focus changes - I don't think you'll get anything from observing focusedChild on an actual child.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Focus Management Issue in Roku Channel - TextEditBox Not Receiving Focus
Got it, so this is nothing like android development lol. 😆
It's funny because I asked the big 3 AI's and chatgpt swore up and down it should automatically popup when focused. Bing wasn't sure what to do. And bard hallucinated and said there was a "JavaScript" keyboard that could be ran in the brightscript.
I will go ahead and try out your solution and let you know. Thank you for the assistance!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Focus Management Issue in Roku Channel - TextEditBox Not Receiving Focus
Yeah, welcome to the wild west!
Roku dev is too niche for ChatGPT etc to be competent, I think - Stack Overflow is not that useful either, which is related.
There's a Slack chat which people find helpful (it gets linked from these forums fairly often) but I prefer to leave answers which are easily searchable in future so I haven't looked in on that. Maybe I need to rethink my opposition to siloed content in the age of AI though...
Good luck
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content