haamro
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2015
12:54 PM
Error going back in multi-level GridScreen
I am developing a Multi-level(like folders with subfolders or files in it) app with GridScreen, that can have Sub-gridscreen (with videos) or just the Video Files depending on the variable getContent="Yes" or "No" .
If the getContent="yes" then I am calling ShowGridScreen within itself again when the item is selected. And it works Great. But the problem is , when I pressed the GoBack button on roku, it goes to the previous Grid but throws an error on
return -1
and then nothing works, I cannot select any videos/folders again.
Can you tell me what am I doing wrong ?
If the getContent="yes" then I am calling ShowGridScreen within itself again when the item is selected. And it works Great. But the problem is , when I pressed the GoBack button on roku, it goes to the previous Grid but throws an error on
return -1
and then nothing works, I cannot select any videos/folders again.
Can you tell me what am I doing wrong ?
Function showGridScreen(screen As Object,SourceURL as string) As string
categoryList = getCategoryList(SourceURL)
screen.setupLists(categoryList.count())
screen.SetListNames(categoryList)
showArray = []
for i = 0 to categoryList.count()-1
channels = getShowsForCategoryItem(SourceURL,categoryList[i])
showArray[i] = channels
screen.SetContentList(i, channels)
end for
screen.Show()
while true
msg = wait(0, m.port)
if type(msg) = "roGridScreenEvent" then
if msg.isScreenClosed() then
return -1
else if msg.isListItemFocused()
print "Focused On: " + showArray[msg.GetIndex()][msg.GetData()]["title"]
else if msg.isListItemSelected()
print "Selected: " + showArray[msg.GetIndex()][msg.GetData()]["title"]
getcontent=showArray[msg.GetIndex()][msg.GetData()]["GetContent"]
if getcontent="Yes" then
print "We Need to retrieve Content"
newURL=showArray[msg.GetIndex()][msg.GetData()]["StoredURL"]
print newURL
newScreen = preShowGridScreen()
showGridScreen(newScreen,newURL)
else
print "No need to Grab Content, Playing Video"
showVideoScreen( showArray[msg.GetIndex()][msg.GetData()])
endif
endif
endif
end while
end function
6 REPLIES 6
belltown
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2015
01:06 PM
Re: Error going back in multi-level GridScreen
Function showGridScreen(screen As Object,SourceURL as string) As string
return -1
You can't return an Integer from a function with a return type of String. You have to either return a string, e.g. "", or change the function's return type, e.g. Dynamic, making sure that the caller of the function can handle whatever is returned.
haamro
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2015
10:12 PM
Re: Error going back in multi-level GridScreen
Thankx, return -1 changed to return "" and the error is gone.
Now I press the GoBack button at Level 2 Grid Screen, there is no error and the Level 1 GridScreen is shown, but I cannot select any of the items there. It appears that I exited all the loops.
Any idea why is this happening ?
Now I press the GoBack button at Level 2 Grid Screen, there is no error and the Level 1 GridScreen is shown, but I cannot select any of the items there. It appears that I exited all the loops.
while true
msg = wait(0, m.port)
Any idea why is this happening ?
haamro
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2015
10:05 PM
Re: Error going back in multi-level GridScreen
Bump
so when msg.isScreenClosed is triggered, thats when it exits the while loop . How do I fix it ?
while true
msg = wait(0, m.port)
if type(msg) = "roGridScreenEvent" then
if msg.isScreenClosed() then
return ""
so when msg.isScreenClosed is triggered, thats when it exits the while loop . How do I fix it ?
haamro
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-14-2015
07:27 PM
Re: Error going back in multi-level GridScreen
BUMP!
Can somebody help me on this issue.
Can somebody help me on this issue.
belltown
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-14-2015
11:23 PM
Re: Error going back in multi-level GridScreen
1. Your showGridScreen function doesn't seem like it needs to return anything, so don't; just declare the return type with As Void.
2. Replace the Return -1 or Return "" statement in your while loop with exit while.
3. Don't share message ports between your recursively-called grid screen functions. Instead, at the start of showGridScreen, use: port = CreateObject ("roMessagePort") and screen.SetMessagePort (port), then replace all occurrences of m.port with port.
Number 3 is your main problem, but the others are worth addressing to make your code more understandable.
2. Replace the Return -1 or Return "" statement in your while loop with exit while.
3. Don't share message ports between your recursively-called grid screen functions. Instead, at the start of showGridScreen, use: port = CreateObject ("roMessagePort") and screen.SetMessagePort (port), then replace all occurrences of m.port with port.
Number 3 is your main problem, but the others are worth addressing to make your code more understandable.
haamro
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-16-2015
11:54 AM
Re: Error going back in multi-level GridScreen
^ Thank you Very much. It solved my problem.