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()]
title = grid
**THROWS**
Type Mismatch. (runtime error &h18) in ...skqSY/pkg:/source/appMain.brs(96)
096: print "Title => "+title
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
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
"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.
"RokuJoel" wrote: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).
You can look at a grid as an array of arrays of associative arrays.