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

Re: Grid Screen Development And Documentation

The error message means "grid" is not an array, or "grid[msg.GetData()]" is not an array. You can do those steps separately to see which is the problem.

--Mark
0 Kudos

Re: Grid Screen Development And Documentation

Tried both of those and here are the results:


title = grid[msg.GetData()]

**THROWS**

Array operation attempted on variable not DIM'd. (runtime error &he7) in ...adUeh/pkg:/source/appMain.brs(95)
095: title = grid[msg.GetData()]


And........


title = grid

**THROWS**

Type Mismatch. (runtime error &h18) in ...skqSY/pkg:/source/appMain.brs(96)
096: print "Title => "+title
שלום חבר

Dean at the School of Truth: a part of Autodidact University.

"A programmer is just a tool which converts caffeine into code"
Temet nosce
Vi Veri Veniversum Vivus Vici
Si vis pacem, para bellum
0 Kudos
RokuMarkn
Visitor

Re: Grid Screen Development And Documentation

In the list of variables that is printed in the debugger, what is the type of grid? Your code expects it to be an array, but it doesn't seem to be.
0 Kudos

Re: Grid Screen Development And Documentation

grid is showing as roGridScreen

From the last output:

Local Variables:
global &h0020 rotINTERFACE:ifGlobal
m &h0010 bsc:roAssociativeArray, refcnt=2
request &h0010 bsc:roUrlTransfer, refcnt=1
html &h8010 bsc:roString (2.1 was String), refcnt=1
rsp &h0010 bsc:roXMLElement, refcnt=1
port &h0010 bsc:roMessagePort, refcnt=2
grid &h0010 bsc:roGridScreen, refcnt=3
rowtitles &h0010 bsc:roArray, refcnt=1
j &h0002 Integer val:4
total_count &h0002 Integer val:40
divided_count &h0004 Float val:4
iterator &h0002 Integer val:40
list &h0010 bsc:roArray, refcnt=1
i &h0002 Integer val:40
title &h0010 bsc:roGridScreen, refcnt=3
sd_img &h0010 bsc:roString, refcnt=3
hd_img &h0010 bsc:roString, refcnt=3
o &h0010 bsc:roAssociativeArray, refcnt=2
msg &h0010 bsc:roGridScreenEvent, refcnt=1
שלום חבר

Dean at the School of Truth: a part of Autodidact University.

"A programmer is just a tool which converts caffeine into code"
Temet nosce
Vi Veri Veniversum Vivus Vici
Si vis pacem, para bellum
0 Kudos

Re: Grid Screen Development And Documentation

Ok, so still not sure if it's even possible to pull the information from a selected item after the grid is built and displayed, but I created a band-aid; a work-around. I created my own content array before the looping to create the grid screen information. As the loop iterates through the information and builds the grid screen, I insert the information into my own array which I can then use later on at will.



iterator = 0

' Create my own content array with the same number of items
content = CreateObject("roArray", 4, true)

for j = 0 to 3
list = CreateObject("roArray", 4, true)

for i = (0+iterator) to (iterator+9)
title = rsp.item[i].title.gettext()
sd_img = rsp.item[i]@sdImg
hd_img = rsp.item[i]@hdImg

o = CreateObject("roAssociativeArray")
o.ContentType = "episode"
o.Title = title
o.ShortDescriptionLine1 = "[ShortDescriptionLine1]"
o.ShortDescriptionLine2 = "[ShortDescriptionLine2]"
o.Description = ""
o.Description = "[Description] "
o.Rating = "NR"
o.StarRating = "75"
o.ReleaseDate = "[<mm/dd/yyyy]"
o.Length = 5400
o.SDPosterUrl = sd_img
o.HDPosterUrl = hd_img
o.Actors = []
o.Actors.Push("[Actor1]")
o.Actors.Push("[Actor2]")
o.Actors.Push("[Actor3]")
o.Director = "[Director]"
list.Push(o)

iterator = iterator + 1
end for

' Add the content to our own custom array
content[j] = list

grid.SetContentList(j, list)
end for
grid.Show()
while true
msg = wait(0, port)
if type(msg) = "roGridScreenEvent" then
if msg.isScreenClosed() then
'return -1
elseif msg.isListItemFocused()
print "Focused msg: ";msg.GetMessage();"row: ";msg.GetIndex();
print " col: ";msg.GetData()

' Now that we know what is selected through the GetData() and GetIndex(), we can now access the information from our own array of information
title = content[msg.GetData()][msg.GetIndex()].Title
print "Title => "+title

elseif msg.isListItemSelected()
print "Selected msg: ";msg.GetMessage();"row: ";msg.GetIndex();
print " col: ";msg.GetData()
endif
endif
end while
שלום חבר

Dean at the School of Truth: a part of Autodidact University.

"A programmer is just a tool which converts caffeine into code"
Temet nosce
Vi Veri Veniversum Vivus Vici
Si vis pacem, para bellum
0 Kudos
EnTerr
Roku Guru

Re: Grid Screen Development And Documentation

"DukeOfMarshall" wrote:
Ok, so still not sure if it's even possible to pull the information from a selected item after the grid is built and displayed, but I created a band-aid; a work-around. I created my own content array before the looping to create the grid screen information. As the loop iterates through the information and builds the grid screen, I insert the information into my own array which I can then use later on at will.

Hm, yeah. Joel was confusing starting with
"RokuJoel" wrote:
You can look at a grid as an array of arrays of associative arrays.
That's easy to mis-interpret. You cannot "look at [the] grid as an array of ..." - no peeking. It's a black box, all it will give you back is row# and column#. But then he kinda/sorta redeemed what was said by adding at the end "create your grid as an array first, and then use it to set the rows of the grid" (it's better here to take that out of context).

Yes, it's up to you to keep track of what metadata you fed roGridScreen, in your own structures.
0 Kudos

Re: Grid Screen Development And Documentation

Aaahhh, that's starting to clarify.

So just to be more specific, you CAN'T get information from the grid screen. You HAVE to have a separate array of information to access from with the same indexes/structure of information.

Is that correct?
שלום חבר

Dean at the School of Truth: a part of Autodidact University.

"A programmer is just a tool which converts caffeine into code"
Temet nosce
Vi Veri Veniversum Vivus Vici
Si vis pacem, para bellum
0 Kudos

Re: Grid Screen Development And Documentation

Ok, So I'm trying to set the url for each video in the grid screen meta data, but having no luck. Should it be set via StreamUrls or Stream?
שלום חבר

Dean at the School of Truth: a part of Autodidact University.

"A programmer is just a tool which converts caffeine into code"
Temet nosce
Vi Veri Veniversum Vivus Vici
Si vis pacem, para bellum
0 Kudos
destruk
Binge Watcher

Re: Grid Screen Development And Documentation

Either will work.
0 Kudos
anilsoni85
Visitor

Re: Grid Screen Development And Documentation

where is the documentation for properties of GridScreen. ifGridScreen or GridSceen component documentation only talks about the available methods.

 need to see documentation about focusedContent & rowItemSelected properties of grid and need to know if i can change focusedContent from brightscript while grid is not visible and if that will fire rowItemSelected event or not.
0 Kudos