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: 
georgejecook
Level 7

Can we style dialog boxes?

Is it possible to make custom dialogs which have a very distinct style from the ones in the samples?

I'm in the process of rolling my own and want to check before I get too far into that.
George Cook
https://linkedin.com/in/georgejecook/
Roku developers slack group (http://tiny.cc/nrdf0y) : georgejecook

Contact me on roku developer slack group, or via pm to discuss consultancy/work opportunities/rooibos unit testing framework
0 Kudos
5 Replies
joetesta
Level 10

Re: Can we style dialog boxes?

yes Smiley Happy
aspiring
0 Kudos
georgejecook
Level 7

Re: Can we style dialog boxes?

Thanks @joetesta - don't suppose you could elaborate? 

I'll add some more questions:

1. Can we set a totally custom, semi transparent background
2. Can we add more buttons/controls and style them to our specific need
3. Can we respond to key events in the dialog
4. How?
George Cook
https://linkedin.com/in/georgejecook/
Roku developers slack group (http://tiny.cc/nrdf0y) : georgejecook

Contact me on roku developer slack group, or via pm to discuss consultancy/work opportunities/rooibos unit testing framework
0 Kudos
joetesta
Level 10

Re: Can we style dialog boxes?

Here is some redacted code from one of my projects that I hope will help answer some of your questions:

sub showWrongMessage()
  m.Message = createObject("RoSGNode","Dialog")
  bg = createFullScreenBg()
  m.Message.insertchild(bg,0)
  m.Message.titleColor = "0xff0000ff"
  m.Message.title = "TRY AGAIN"
  m.Message.message = "You did something wrong:" + chr(10) + "* message on second line " + chr(10) + "* message on third line "
  m.Message.buttons = ["OK"]
  m.Message.observefield("buttonSelected","closeMessageonOK")
  m.Message.observefield("wasClosed","DialogClosed")
  m.top.dialog = m.Message
end sub


sub createFullScreenBg() As Object
  bg = createObject("roSGNode", "Rectangle")
  bg.height = 1080
  bg.width = 1920
  bg.color = "0x00000044"
  return bg
end sub
aspiring
0 Kudos
joetesta
Level 10

Re: Can we style dialog boxes?

In my code "createFullScreenBg" you can create a semi-transparent background.  I'm using a rectangle but just as easily you can use a poster with the correct dimensions and opacity.  My dimensions are for fhd (setting in the manifest).

You can create more buttons in the array and detect which button is pressed on the buttonSelected value.  You could also create custom controls that you'd have to manage the navigation of.  you should be able to manage all navigation and keypress handling with an onKeyEvent function in the parent scene.

I left out the two functions called by observers, but they should be fairly easy, lemme know if you need them.
aspiring
0 Kudos
joetesta
Level 10

Re: Can we style dialog boxes?

I haven't experimented with "buttonGroup" yet but https://sdkdocs.roku.com/display/sdkdoc/Dialog says
"This allows the appearance attributes of all the Button nodes in the dialog to be easily modified. Since the ButtonGroup node class is derived from the LayoutGroup node class, additional non-Button node children can also be added."
aspiring
0 Kudos