Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
dcrandall
Visitor

roTextScreen and auto/manual focus on a button.

I don't know if this was the right thread ( http://forums.roku.com/viewtopic.php?f=34&t=65885 ), but if it wasn't, I'm breaking-out the topic here:

Is there a way to manually send focus to a button?

I ask because our application has these roTextScreens, and the desire was to have an illustrated 'back' button. To get the back button to work, one has to get the focus in that direction. It usually takes one button press to remove the focus from the roTextScreen scroll area to the buttons, and another key press to activate the button.

So we pull-up our 'roTextScreen' and we have to go 'click click' on the ok button to go back.

I know the back button is there, and it works, but it's the way we use it...so it's the way we think our customers will.
0 Kudos
26 REPLIES 26
RokuJoel
Binge Watcher

Re: roTextScreen and auto/manual focus on a button.

Sorry, there is no secret method for setting the button focus.

Better approach would be to create your own custom screen and not use the roTextScreen, that screen type was created for one purpose, which was to display and accept a click-through agreement on the firmware 4.9 home screen. It isn't really suited for any other purpose.

- Joel
0 Kudos
TheEndless
Channel Surfer

Re: roTextScreen and auto/manual focus on a button.

"RokuJoel" wrote:
It isn't really suited for any other purpose.

Well, if that's not thinking inside the box, I don't know what is... 😉

OP, you could send an OK click via ECP once the screen is drawn to force a focus change.
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos
dcrandall
Visitor

Re: roTextScreen and auto/manual focus on a button.

"TheEndless" wrote:


OP, you could send an OK click via ECP once the screen is drawn to force a focus change.


Thank you, this works!

Here's my fix if anyone needs it.



fnSimulateKeyPressECP("Select")

function fnSimulateKeyPressECP(keypress as string) as void

url = "http://127.0.0.1:8060/keypress/" + keypress

request = CreateObject("roUrlTransfer")
port = CreateObject("roMessagePort")
request.SetMessagePort(port)
request.SetUrl(url)

request.PostFromString("")


end function
0 Kudos
RokuJoel
Binge Watcher

Re: roTextScreen and auto/manual focus on a button.

"TheEndless" wrote:
"RokuJoel" wrote:
It isn't really suited for any other purpose.

Well, if that's not thinking inside the box, I don't know what is... 😉

OP, you could send an OK click via ECP once the screen is drawn to force a focus change.


In the future the way the ECP works might change, with that in mind, I try to avoid recommending outside the box hacks like that.

- Joel
0 Kudos
EnTerr
Roku Guru

Re: roTextScreen and auto/manual focus on a button.

"dcrandall" wrote:
Thank you, this works! Here's my fix if anyone needs it.
...
url = "http://127.0.0.1:8060/keypress/" + keypress
...

This won't work with 1st gen players (fw3), if i remember - loopback interface is blocked, have to find the external IP instead. And that makes me uneasy since that may get axed: usually it's the other way around - host firewall will block loopbacks on external interface but allows that on 127.0.0.1

Joel - can't you just put a word on roTextScreen to be fixed up a bit? viewtopic.php?f=34&t=65885
To me it seems like a fixer-upper (and then we can start flipping it 🙂 )
0 Kudos
dcrandall
Visitor

Re: roTextScreen and auto/manual focus on a button.

I hate to ask, but I have to ask... say my little ECP hack gets blocked in the future with the loopback like that, is it going to be like, blow-up bad, or just sad-trombone bad?

Because as it's used, if it doesn't work, it's just sad-trombone bad.

Feature request - Could I find out if the text scrolls in roTextScreen? Like, if there's 2 lines of text, there's no scrolling. If there's 400 lines of text, there's gonna be some scrollin'. Without guessing by newlines and character counts, I can't know.
0 Kudos
kc8pql
Visitor

Re: roTextScreen and auto/manual focus on a button.

... is it going to be like, blow-up bad, or just sad-trombone bad?

I gotta remember that... Smiley LOL
____________________________________________________________________________________________________________
No, I don't work for Roku.
Netflix Player N1000X, XDS 2100X (premature death by lightning)
Roku2 XD 3050X, Roku2 XS 3100R, Roku2 4210R
0 Kudos
TheEndless
Channel Surfer

Re: roTextScreen and auto/manual focus on a button.

"RokuJoel" wrote:
In the future the way the ECP works might change, with that in mind, I try to avoid recommending outside the box hacks like that.

I was actually referring to your dismissal of using the roTextScreen for anything other than license agreements as being inside the box. My ECP suggestion is definitely a hack.. no question about that.

"dcrandall" wrote:
I hate to ask, but I have to ask... say my little ECP hack gets blocked in the future with the loopback like that, is it going to be like, blow-up bad, or just sad-trombone bad?

Since it's just a web request, it should only be sad-trombone bad. You might be safer grabbing the device's IP (via roDeviceInfo) instead of using the loopback address, though, as I'd bet that much less likely to change.

"dcrandall" wrote:
Feature request - Could I find out if the text scrolls in roTextScreen? Like, if there's 2 lines of text, there's no scrolling. If there's 400 lines of text, there's gonna be some scrollin'. Without guessing by newlines and character counts, I can't know.

Hehe.. there's no built-in method of setting focus on the buttons, what makes you think there'd be a way to determine if it's scrollable? 😛 Nope, making an educated guess based on content length is probably your best bet.
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos
RokuJoel
Binge Watcher

Re: roTextScreen and auto/manual focus on a button.

I would stick to using the loopback address, except on Legacy devices where it doesn't work.

-Joel
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.