I'm having a problem with the grid screen that I created. When navigating through the screen (up/down/left/right), the row/column index (in the upper right corner of the screen) is not updating. It just stays at "01 | 01". This is the default index display in the grid screen, not the breadcrumb. My code is below. Please help!
Function showMovieGridScreen(solrIP as string)
port = CreateObject("roMessagePort")
grid = CreateObject("roGridScreen")
grid.SetMessagePort(port)
grid.SetUpBehaviorAtTopRow("exit")
genres = CreateObject("roAssociativeArray")
genres = retrieveGenreList(solrIP, "Movie")
genresCount = 0
for each genre in genres
genresCount = genresCount + 1
end for
rowTitles = CreateObject("roArray", genresCount, true)
for each genre in genres
rowTitles.Push(genre)
end for
grid.SetupLists(rowTitles.Count())
grid.SetListNames(rowTitles)
rowIndex = CreateObject("roInt")
rowIndex.SetInt(0)
for each genre in genres
currentRowList = CreateObject("roArray", genres.Lookup(genre), true)
grid.SetContentList(rowIndex.GetInt(), retrieveMovieDataForGrid(solrIP, genre, currentRowList))
rowIndex.SetInt(rowIndex.GetInt() + 1)
end for
grid.Show()
while true
msg = wait(0, port)
if type(msg) = "roGridScreenEvent" then
if(msg.isScreenClosed()) then
return -1
else if(msg.isListItemFocused()) then
print "Focused msg: ";msg.GetMessage();"row: ";msg.GetIndex();
print " col: ";msg.GetData()
else if(msg.isListItemSelected()) then
print "Selected msg: ";msg.GetMessage();"row: ";msg.GetIndex();
print " col: ";msg.GetData()
end if
endif
end while
End Function
Function retrieveMovieDataForGrid(solrIP as string, genre as string, rowList as object) as object
request = CreateObject("roUrlTransfer")
searchUrl = "http://" + solrIP + ":8080/solr/collection1/select?q=genre:" + genre + "&type:Movie&wt=xml&omitHeader=true"
request.SetUrl(searchUrl)
results = request.GetToString()
xmlRoot = CreateObject("roXMLElement")
xmlContent = CreateObject("xoXMLElement")
xmlFields = CreateObject("roXMLElement")
if xmlRoot.Parse(results) then
xmlContent = xmlRoot.result.getChildElements()
isMovieToAdd = CreateObject("roBoolean")
isMovieToAdd.SetBoolean(false)
for each listing in xmlContent
xmlFields = listing.getChildElements()
for each record in xmlFields
if record@name = "title" then
spaces = CreateObject("roRegex", " ", "i")
movieTitle = spaces.ReplaceAll(record.GetText(), "%20")
movie = CreateObject("roAssociativeArray")
movie.ContentType = "movie"
movie.Title = record.GetText()
movie.SDPosterUrl = "http://" + solrIP + ":8080/Collection/" + movieTitle + "/poster.jpg"
movie.HDPosterUrl = "http://" + solrIP + ":8080/Collection/" + movieTitle + "/poster.jpg"
isMovieToAdd.SetBoolean(true)
end if
if record@name = "rated" then
movie.Rating = record.GetText()
isMovieToAdd.SetBoolean(true)
end if
if record@name = "year" then
movie.ReleaseDate = record.GetText()
isMovieToAdd.SetBoolean(true)
end if
if record@name = "starRating" then
movie.StarRating = record.GetText()
isMovieToAdd.SetBoolean(true)
end if
if record@name = "runtime" then
runtimeRegex = CreateObject("roRegex", " min", "i")
movieRuntime = runtimeRegex.ReplaceAll(record.GetText(), "").toInt()
movieRuntime = movieRuntime * 60
movie.Length = movieRuntime.toStr()
isMovieToAdd.SetBoolean(true)
end if
if record@name = "plot" then
movie.Description = record.GetText()
isMovieToAdd.SetBoolean(true)
end if
next
if isMovieToAdd.GetBoolean() then
rowList.Push(movie)
end if
next
end if
return rowList
End Function