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: 
KeelinJ
Visitor

SetGridStyle()

Hi all,

I'm having trouble changing the style of the roGridScreen (using SetGridStyle()) to anything other than the default (flat-movie). Is anyone else having this problem?

-Keelin
0 Kudos
4 REPLIES 4
TheEndless
Channel Surfer

Re: SetGridStyle()

Can you elaborate on the kind of trouble you're having? I've used virtually every different grid style across my channels, so they definitely work. Perhaps you could post the code you're using as well...?
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
KeelinJ
Visitor

Re: SetGridStyle()

That's good, I must be doing something wrong then. I'm just running some basic code to see what layout I want to use. It's pretty close to the example in the Component Reference document. If you see what I'm doing wrong, I'd love to hear what it is.

This is the function I'm using to set up the roGridScreen:

Function ShowGrid()

port = CreateObject("roMessagePort")
grid = CreateObject("roGridScreen")
grid.SetMessagePort(port)

rowTitles = CreateObject("roArray", 10, true)
for j = 0 to 4
rowTitles.Push("[Row Title "+j.toStr()+" ] ")
end for
grid.SetupLists(rowTitles.Count())
grid.SetListNames(rowTitles)
grid.SetGridStyle("flat-16x9")
grid.SetDescriptionVisible(false)


for j = 0 to 4
list = CreateObject("roArray", 10, true)
for i = 0 to 2
o = CreateObject("roAssociativeArray")
o.ContentType = "episode"
o.Title = "[Title"+i.toStr()+"]"
o.ShortDescriptionLine1 = "[ShortDescriptionLine1]"
o.ShortDescriptionLine2 = "[ShortDescriptionLine2]"
o.Description = "[Description]"
o.Description = "[Description2]"
o.Rating = "NR"
o.StarRating = "75"
o.ReleaseDate = "03/25/2011"
o.Length = 196
o.Actors = []
o.Actors.Push("[Actor1]")
o.Actors.Push("[Actor2]")
o.Actors.Push("[Actor3]")
o.Director = "[Director]"
o.SDPosterUrl = "[poster url]"
o.HDPosterUrl = "[poster url]"

list.Push(o)
end for
grid.SetContentList(j, list)
end for

grid.Show()

while true
msg = wait(0, port)
if type(msg) = "roGridScreenEvent" then
if msg.isScreenClosed()
return -1
elseif msg.isListItemFocused()
print "Focused msg: ";msg.GetMessage(),"row: ";msg.GetIndex(),
print " col: ";msg.GetData()
elseif msg.isListItemSelected()
print "Selected msg: ";msg.GetMessage(),"row: ";msg.GetIndex(),
print " col: ";msg.GetData()
grid.ShowMessage("You selected Row "+Stri(msg.GetIndex())+" Column "+Stri(msg.GetData()))
endif
endif
end while
End Function

Thanks for your time,
-Keelin
0 Kudos
TheEndless
Channel Surfer

Re: SetGridStyle()

It looks like you need to set the grid style prior to calling SetupLists(). Move SetGridStyle() to just before SetupLists() and you should be good to go.
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
KeelinJ
Visitor

Re: SetGridStyle()

Ah, thank you! That was it. It's working perfectly now. I should have thought of that. Thanks for your help.
0 Kudos