Your Digital Media Has Never Looked So Good

 
haamro
Topic Author
Posts: 19
Joined: Wed Feb 25, 2015 6:07 am

Handling Back Button in Multi-level Screen

Thu Nov 02, 2017 3:13 pm

Hello everyone, I am working on Multi-level screen. Based on the data from XML, my ROKU app either displays the folder or the video file. The folder can have another folder as well as video files in it. The following code works great

my init()
  m.UriHandler  = createObject("roSGNode","UriHandler")
  url = "http://example/file.xml"
  makeRequest({}, url, "GET", 0, "")
  m.UriHandler.observeField("content","onContentSet")
  m.RegistryTask.observeField("result","onReadFinished")


sub onRowItemSelected(event as object)
print "onRowItemSelected"
  m.array = m.HomeScreen.rowItemSelected
  node = m.HomeRow.content.getchild(m.array[0]).getchild(m.array[1])
  m.UriHandler.category = node.title
  print  m.UriHandler.cache.hasField(m.UriHandler.category)
  isFolder= node.isFolder
  title=node.title
  print title
  m.UriHandler.contentSet = false
      if isFolder="Yes" ' Now we need to load more folders from the XML which is loaded on node.storedURL
        url=node.storedURL
        m.baseURL=url
        makeRequest({}, url, "GET", 0, title)
        m.UriHandler.observeField("content","onContentSet")
        m.RegistryTask.observeField("result","onReadFinished")
    
      else if isFolder="No"
        print "now this is file, we need to play it"
      end if

end sub


How do I work with Back Button, so that it takes me 1 level up. and when it reaches home screen it should exit the app. ?

thank you
 
haamro
Topic Author
Posts: 19
Joined: Wed Feb 25, 2015 6:07 am

Re: Handling Back Button in Multi-level Screen

Tue Nov 14, 2017 6:32 pm

bump. 
 
joetesta
Posts: 598
Joined: Wed Apr 20, 2011 11:48 am

Re: Handling Back Button in Multi-level Screen

Tue Nov 14, 2017 9:39 pm

you should be able to add onKeyEvent function to your pages to catch and handle back clicks.
hope it may help.
aspiring
 
haamro
Topic Author
Posts: 19
Joined: Wed Feb 25, 2015 6:07 am

Re: Handling Back Button in Multi-level Screen

Mon Dec 04, 2017 12:15 pm

joetesta wrote:
you should be able to add onKeyEvent function to your pages to catch and handle back clicks.
hope it may help.

I am a novice on this. Would you mind explaining with little more detail, may be with code ?
Thanx
 
User avatar
squirreltown
Posts: 752
Joined: Sun Apr 21, 2013 2:20 pm

Re: Handling Back Button in Multi-level Screen

Mon Dec 04, 2017 2:51 pm

haamro wrote:
I am a novice on this. Would you mind explaining with little more detail, may be with code ?
Thanx

The OnKeyEvent() function is in most scenegraph examples I've seen. The best thing would be to first look at those and see where and how that function is used.
Kinetics Screensaver (kineticsscreensaver), Kinetics³ Screensaver(kinetics3), Kinetics Painter Screensaver (kineticspainter), Kinetics Splash Screensaver (kineticssplash)

Who is online

Users browsing this forum: No registered users and 5 guests