1

I wanted to use a keyboard or a mini keyboard widget for a Roku channel. Rendering a keyboard on the display is straight forward however I cannot find any information on creating an observer for the keyboard entry and how one goes about selecting the string just entered on the keyboard. The Roku docs offer this:

In a real application, you would probably want to group the MiniKeyboard node with a Button node (or possibly a ButtonGroupnode) to allow the user to inform the application that the string entry is complete (or possibly canceled).

I cannot figure out how to actually do this.

TKPhillyBurb
  • 91
  • 3
  • 11

2 Answers2

2

In the parent screen containing the keyboard component, you use an onKeyEvent function to listen for navigational keypresses and move the focus to the "submit" button and back to the keyboard as appropriate. Then in the same onKeyEvent function, if "OK" is pressed and submit button has focus, you use the keyboard.text field as the submitted string. If you need more detail, let me know what you tried and what's going wrong.

Joe T
  • 2,300
  • 1
  • 19
  • 31
  • I use the same thing in my code. It works for only textbox and one button. I tried to two textboxes and one button group that time issue will generated if your free time pls check my code. – Nikunj Chaklasiya Jul 17 '19 at 11:39
1

To listen on user input on either the Keyboard or MiniKeyboard components you just have to observe the text field.

For example:

sub setupKeyboard()
  m.keyboard = m.top.createChild("Keyboard")
  m.keyboard.observeField("text", "onTextEntered")
end sub

sub onTextEntered()
  ?"Text entered: "m.keyboard.text
end sub
Alejandro Cotilla
  • 2,501
  • 1
  • 20
  • 35