Forum Discussion

NewbyDeveloper's avatar
11 years ago

SlideShow Example Anywhere?

Hi

As part of an app I'm writing I want to show a slideshow of user pictures.

I can see the commands ifSlideshow mentioned - with setcontent - etc.

But an example would allow me to understand it.

Is there a simple example anywhere that uses this command?

Thanks

9 Replies

  • Also...rather than a full blown slide show facility - is there a simple bit of code that will just take a url to a JPEG/JPG/PNG/GIF and display it on the screen until the user presses OK or back button?
  • Sub Main ()
    displayImage ("http://www.welikeviral.com/files/2014/12/8325_8_site.jpeg")
    End Sub

    Function displayImage (imageUrl As String) As Void
    port = CreateObject ("roMessagePort")
    ui = CreateObject ("roImageCanvas")
    ui.SetMessagePort (port)
    ui.SetRequireAllImagesToDraw (True)
    ui.SetLayer (1, {Url: imageUrl})
    ui.Show ()
    While True
    msg = Wait (0, port)
    If Type (msg) = "roImageCanvasEvent"
    If msg.IsScreenClosed ()
    Exit While
    Else If msg.IsRemoteKeyPressed ()
    key = msg.GetIndex ()
    If key = 0 ' Back Button
    ui.Close ()
    Else If key = 6 ' OK Button
    ui.Close ()
    EndIf
    EndIf
    EndIf
    End While
    End Function
  • Or this:

    Sub Main ()
    displaySlideShow ([{Url: "http://www.welikeviral.com/files/2014/12/8325_8_site.jpeg"}])
    End Sub

    Function displaySlideShow (contentList As Object) As Void
    port = CreateObject ("roMessagePort")
    ui = CreateObject ("roSlideShow")
    ui.SetMessagePort (port)
    ui.SetContentList (contentList)
    ui.Show ()
    While True
    msg = Wait (0, port)
    If Type (msg) = "roSlideShowEvent"
    If msg.IsScreenClosed ()
    Exit While
    Else If msg.IsRemoteKeyPressed ()
    key = msg.GetIndex ()
    If key = 0 ' Back Button
    ui.Close ()
    Else If key = 6 ' OK Button
    ui.Close ()
    EndIf
    EndIf
    EndIf
    End While
    End Function
  • Thanks again - another question...

    With the ("roSlideShow") example - I see you passing across the url to the jpeg...
    and I've looked at the documentation online - but non the wiser....

    How do you pass across an array of files to let the slide show show all those images one after the other?
  • "NewbyDeveloper" wrote:
    Thanks again - another question...

    With the ("roSlideShow") example - I see you passing across the url to the jpeg...
    and I've looked at the documentation online - but non the wiser....

    How do you pass across an array of files to let the slide show show all those images one after the other?


    I'm actually passing an array of urls, hence the square brackets,[ ], around the url list.The list just happens to contain only one item, but could have been written like this, for example:

            displaySlideShow ([
    {Url: "http://www.welikeviral.com/files/2014/12/8325_8_site.jpeg"}
    {Url: "http://www.welikeviral.com/files/2015/01/Hide-And-Seek-3.jpg"}
    {Url: "http://www.welikeviral.com/files/2015/01/Hide-And-Seek-5.jpg"}
    ])


    Or this:

    contentList = []
    contentList.Push ({Url: "http://www.welikeviral.com/files/2014/12/8325_8_site.jpeg"})
    contentList.Push ({Url: "http://www.welikeviral.com/files/2015/01/Hide-And-Seek-3.jpg"})
    contentList.Push ({Url: "http://www.welikeviral.com/files/2015/01/Hide-And-Seek-5.jpg"})
    displaySlideShow (contentList)