Photo Screen Saver

Discussion in 'Pascal Logic Code Examples' started by Darren, Sep 27, 2005.

  1. Darren

    Darren Senior Member

    Joined:
    Jul 29, 2004
    Messages:
    2,361
    Likes Received:
    0
    Location:
    Adelaide, South Australia
    This post describes how to implement a "screen saver" in the Colour C-Touch to display a series of photos when the unit hasn't been used for a while.

    The steps are :
    1. Create a series of "photo pages", each with a photo placed on it with a link back to the time-out page. Ideally the photos should be 640 x 480.
    2. Add the following logic code
    3. Update the logic to :
    - use different timer numbers if needed
    - change the time-out periods if desired
    - add or remove pages as required
    - change the name of the "Main Page" if needed

    Code:
    [b]{ constants section }[/b]
    
    { These are the two timers used by the Screen Saver }
    ssTimeOutTimer = 1;
    ssPageTimer = 2;
    
    [b]{ module }[/b]
    
    { This module implements a "Screen Saver".
      A timer is started when the page changes to the main page.
      When the timer gets to 1 minute, the "photo" pages
      are displayed in sequence. }
    
    { Main page has been selected.
      Start timer. }
    once ShowingPage("Main Page") then
    begin
      TimerStart(ssTimeOutTimer);
      TimerStop(ssPageTimer);
    end;
    
    { Main page has been de-selected.
      Stop timer. }
    once not ShowingPage("Main Page") then
      TimerStop(ssTimeOutTimer);
    
    { Main page timer has expired.
      Show first photo page. }
    if TimerTime(ssTimeOutTimer) = "00:01:00" then
    begin
      ShowPage("Photo Page 1");
      TimerStart(ssPageTimer);
    end;
    
    { Photo page timer has expired.
      Show next photo page. }
    if TimerTime(ssPageTimer) = "00:00:10" then
    begin
      TimerStart(ssPageTimer);
      if ShowingPage("Photo Page 1") then
        ShowPage("Photo Page 2")
      else if ShowingPage("Photo Page 2") then
        ShowPage("Photo Page 3")
      else if ShowingPage("Photo Page 3") then
        ShowPage("Photo Page 4")
      else if ShowingPage("Photo Page 4") then
        ShowPage("Photo Page 5")
      else if ShowingPage("Photo Page 5") then
        ShowPage("Photo Page 6")
      else if ShowingPage("Photo Page 6") then
        ShowPage("Photo Page 1");
    end;
    
     
    Darren, Sep 27, 2005
    #1
  2. Darren

    mikegriff

    Joined:
    Aug 3, 2004
    Messages:
    153
    Likes Received:
    3
    Location:
    Wales
    Thanks for this Darren

    Works a treat

    For info first time you run this you need to switch away from the main page and back again then it fires up Not an issue for normal use but it saves waiting and wondering why it isnt working the first time you load it :)

    Mike
     
    mikegriff, Sep 27, 2005
    #2
  3. Darren

    jay

    Joined:
    Nov 2, 2004
    Messages:
    51
    Likes Received:
    0
    Location:
    Brisbane
    Why don't we just use the normal time out function of the CTC and run the slide show from there ie: Just replace references to the main page to a page called "Timeout" & set the CTC to show that page in "Project Details/Options/Timeout Details"
    We then overcome the issue that mikegriff raises & only use one timer in the logic code.
     
    jay, Oct 7, 2005
    #3
  4. Darren

    Darren Senior Member

    Joined:
    Jul 29, 2004
    Messages:
    2,361
    Likes Received:
    0
    Location:
    Adelaide, South Australia
    Good idea.
     
    Darren, Oct 7, 2005
    #4
  5. Darren

    muppets

    Joined:
    Oct 26, 2007
    Messages:
    98
    Likes Received:
    0
    using the code and further suggestions I have implemented the screen saver however the first screen that loads after an "outage" (simulated by either upload or unplugging) is the first photo page and the sequence doesn't roll on until cancelled by a press and reloading after timeout, my code is as follows:

    { constants section }

    { This is the timer used by the Screen Saver }
    ssPageTimer = 2;


    { module }

    { This module implements a "Screen Saver".
    A timer is started when the page changes to the timeout
    page the "photo" pages are displayed in sequence. }

    { Timeout page has been selected.
    Start timer. }
    once ShowingPage("Page 20") then

    begin
    TimerStart(ssPageTimer);
    end;

    { Photo page timer has expired.
    Show next photo page. }
    if TimerTime(ssPageTimer) = "00:00:10" then
    begin
    TimerStart(ssPageTimer);
    if ShowingPage("Page 20") then
    ShowPage("Page 21")
    else if ShowingPage("Page 21") then
    ShowPage("Page 22")
    else if ShowingPage("Page 22") then
    ShowPage("Page 23")
    else if ShowingPage("Page 23") then
    ShowPage("Page 24")
    else if ShowingPage("Page 24") then
    ShowPage("Page 25")
    else if ShowingPage("Page 25") then
    ShowPage("Page 26")
    else if ShowingPage("Page 26") then
    ShowPage("Page 20");
    end;



    Sorry I cant do the flashy scroll box as above, is there any code I can implement at startup to go to the main page? Or at least start the screen saver sequence?
     
    muppets, Nov 10, 2007
    #5
  6. Darren

    muppets

    Joined:
    Oct 26, 2007
    Messages:
    98
    Likes Received:
    0
    Muppets I have an answer to your question lol :rolleyes: - seems everybody else is at the beach on this fine Sunday.

    Ok the problem faced with the above code is the once command issued for timer starting - somehow appears to get missed on the bootup.

    The fixed code :

    { constants section }

    { This is the timer used by the Screen Saver }
    ssPageTimer = 1;


    { module }

    { This module implements a "Screen Saver".
    A timer is started when the page changes to the timeout
    page the "photo" pages are displayed in sequence. }

    { Timeout page has been selected.
    Start timer. "with if instead of once" }
    if ShowingPage("Page 20") then

    begin
    if TimerRunning(ssPageTimer) then

    { Use an empty if timerrunning to make sure the timer doesn't recycle every
    scan }

    else
    TimerStart(ssPageTimer);
    end;

    { Photo page timer has expired.
    Show next photo page. }
    if TimerTime(ssPageTimer) = "00:00:10" then
    begin
    TimerStart(ssPageTimer);
    if ShowingPage("Page 20") then
    ShowPage("Page 21")
    else if ShowingPage("Page 21") then
    ShowPage("Page 22")
    else if ShowingPage("Page 22") then
    ShowPage("Page 23")
    else if ShowingPage("Page 23") then
    ShowPage("Page 24")
    else if ShowingPage("Page 24") then
    ShowPage("Page 25")
    else if ShowingPage("Page 25") then
    ShowPage("Page 26")
    else if ShowingPage("Page 26") then
    ShowPage("Page 20");
    end;
     
    muppets, Nov 11, 2007
    #6
  7. Darren

    muppets

    Joined:
    Oct 26, 2007
    Messages:
    98
    Likes Received:
    0
    Does the timer need to be stopped if navigating away from the page loop? I haven't found the program not working yet however it seems logical to stop the timer if navigating away from the screen saver pages.

    The timer should keep recycling even when not on this page as far as I can tell - is it bad practice to leave it doing this when not required?
     
    Last edited by a moderator: Nov 12, 2007
    muppets, Nov 12, 2007
    #7
  8. Darren

    graemelisa

    Joined:
    Jul 22, 2010
    Messages:
    7
    Likes Received:
    0
    Location:
    Sydney
    Sub Pages

    Hi

    Re

    Question
    Can you control a Sub Page in logic?
    Answer
    Yes. This can be done via Special Functions and In-built System IO Variables.

    Can anybody show me how to change this 'Photo Screen Saver' code, to do this?

    Thanks in advance!
     
    graemelisa, Jul 31, 2010
    #8
  9. Darren

    Darren Senior Member

    Joined:
    Jul 29, 2004
    Messages:
    2,361
    Likes Received:
    0
    Location:
    Adelaide, South Australia
    The code will be essentially the same as one of the examples above except:

    To select a particular sub page in a frame on the main page:

    Code:
    SetCompIntegerProp("Main Page", "Sub-Page Frame 1", "Current Sub-Page", "Sub Page 1");
    To check if a particular sub-page is being displayed in the frame:

    Code:
    if GetCompIntegerProp("Main Page", "Sub-Page Frame 1", "Current Sub-Page") = 1 then...
    Unfortunately, you can't use a tag for the sub-page in the above code, so you will need to work out the page number of the sub-page. Theme pages and sub-pages are all stored in a single list and are numbered in the order they are added. The first page (Theme Components) is number 0. To see the theme/sub pages in order, open the Program Options form and deselect the Sort Page Lists Alphabetically option. The pages in the main page list will then be shown in the order they were created.

    I will see if I can make this simpler in the next release.
     
    Darren, Jul 31, 2010
    #9
  10. Darren

    finale

    Joined:
    Aug 4, 2010
    Messages:
    5
    Likes Received:
    0
    Location:
    usa
    hey , thanks alot . . . great idea . . . :D
     
    finale, Aug 6, 2010
    #10
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.