Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Search instead for 
Did you mean: 
jaxim
Level 7

Change background of focused letter of MiniKeyboard?

Is there a way to dynamically change the color of the focused letter of the MiniKeyboard? For example, depending on a user setting, I may want to change the background of the focused letter to be red or green. Is there a way to do this?

I know there is a focusBitmapUri property of the MiniKeyboard, which can set the background color of the focused letter for the life of the app, but I would like to be able to change the color dynamically.

Is there a way to give a blendColor for the background letter color?

thanks!
0 Kudos
8 Replies
joetesta
Level 10

Re: Change background of focused letter of MiniKeyboard?

you should be able to update the keyboard's "focusBitmapUri" on the fly in your brs code.
aspiring
0 Kudos
jaxim
Level 7

Re: Change background of focused letter of MiniKeyboard?

thanks, Joe.
I am aware of focusBitmapUri but as I mentioned in my original post, I am looking for a way to dynamically change the color within the code. From what I can see focusBitmapUri can only be used if you know what color you are going to use before you compile the app.[/font]

For example, let's say I have a color picker within the app that allows the user to select any color. Once a color is selected, then I would want to use that color to change the focused letter background.[/font]

Is there a way to do this?[/font]
0 Kudos
Highlighted
joetesta
Level 10

Re: Change background of focused letter of MiniKeyboard?

> you should be able to update the keyboard's "focusBitmapUri" on the fly in your brs code.
Your app would need to contain the color images or else find the remote Uri for them.
Then you need a reference to the keyboard from the parent component or scene that contains the onKeyPress where your color is selected.  let's call it keyboardRef.  You should be able to create this reference with something like m.keyboardRef = m.top.findNode("myKeyboardComponentID")
Once a color is selected, you would just set m.keyboardRef.focusBitmapUri = your desired new color image and it should update on screen immediately.
aspiring
0 Kudos
jaxim
Level 7

Re: Change background of focused letter of MiniKeyboard?

The problem is there could be an unlimited number of colors selected by the user. Is there a way to dynamically color an image and then assign that image to focusBitmapUri?
0 Kudos
joetesta
Level 10

Re: Change background of focused letter of MiniKeyboard?

I think it would be best to have a remote service provide a dynamically colored image based on a param (color) passed in the http request.
aspiring
0 Kudos
jaxim
Level 7

Re: Change background of focused letter of MiniKeyboard?

That solution could work, but I'm unsure if it would be very practical. thanks!
0 Kudos
Komag
Level 9

Re: Change background of focused letter of MiniKeyboard?

Or you could just have a good selection of small colored graphics, such as 100, included in the channel and it picks whichever one is closest (somehow). It would be a bit tricky to program figuring the closest match, but it could be done with decent results.
0 Kudos
necrotek
Level 7

Re: Change background of focused letter of MiniKeyboard?

 You might be able to use a task node to getPNG()

https://sdkdocs.roku.com/display/sdkdoc/ifDraw2D 

The example will draw a colored rectangle and save it to the device storage then set focusBitmapUri to that file
0 Kudos