Image Number in Piced.

Discussion in 'Pascal Logic Code Examples' started by Dave Byron, Nov 7, 2006.

  1. Dave Byron

    Dave Byron

    Joined:
    Aug 3, 2004
    Messages:
    835
    Likes Received:
    0
    Location:
    Casurina
    How do I get the image number ?? The reports list images by name with no number.
    Do the numbers change as contents change page or once assigned stay that way.
    What I need is single page and change the ImageNumber in the DrawImage procedure so can write 100 different images on single page in a slide show.


    This from help file.
    The DrawText procedure draws an image on the screen. This is not applicable for use with the Pascal Automation Controller.

    dave
     
    Dave Byron, Nov 7, 2006
    #1
  2. Dave Byron

    Darren Senior Member

    Joined:
    Jul 29, 2004
    Messages:
    2,361
    Likes Received:
    0
    Location:
    Adelaide, South Australia
    I was hoping that nobody would ever try to do this. You do love to push the envelope, don't you Dave ? ;)
    From memory, they are numbered starting from 0 in the order they appear in the project summary. You could count your way through them to work out which is which.
    They will change. They are numbered in the order in which they are loaded.
    I think you can do it as follows :
    1. Lets say you have 100 images, called "image1.bmp" to "image100.bmp"
    2. Place all of the images you need on one page in the order you want to use them. This page should not be accessable from the other pages (so that it never gets seen).
    3. If the index of the image you want is in a variable called ImageIndex (starting from 0), the code to display the image should be :
    Code:
    DrawImage(100, 200, "image1.bmp" + ImageIndex, false);
    
    At compile time, it will resolve the "image1.bmp" tag to the number of that image (lets say it is 17). Since all of the other images are in order (image 17 to 116), then the above code will be equivalent to :
    Code:
    DrawImage(100, 200, 17 + ImageIndex, false);
    
    Let us know if it works and we can add it to the FAQ.
     
    Darren, Nov 8, 2006
    #2
  3. Dave Byron

    Dave Byron

    Joined:
    Aug 3, 2004
    Messages:
    835
    Likes Received:
    0
    Location:
    Casurina
    Darren,
    Sure works in Piced, not tested in a Ctouch unit at moment.
    Used this code without making a dummy page of images.

    { This module implements a Screen Saver of 104 photos.
    The time-out on the home page is set to be the "photo" page.
    Once the first photo page has been selected, the others will be displayed in sequence until a button is touched }

    if ShowingPage("Photo") then
    begin
    repeat { loop indefinitely almost}
    ClearScreen;
    DrawImage(125, 80, "pic0000.jpg" + Photocnt, true);
    if Photocnt = 103 then
    Photocnt:=0
    else
    Photocnt:= Photocnt+1;
    Delay("00:00:17");
    until not ShowingPage("Photo");
    end; { someone has pressed the screen }

    Now for the Piced bug that does not write logic only referenced images to unit or backup file (or has it been fixed), but noticed without the dummy page the Project Summary Report shows all the images.

    c:\clipsal\piced\projects\wheeler\pic0000.jpg
    c:\clipsal\piced\projects\wheeler\pic0001.jpg
    c:\clipsal\piced\projects\wheeler\pic0002.jpg
    c:\clipsal\piced\projects\wheeler\pic0003.jpg
    c:\clipsal\piced\projects\wheeler\pic0004.jpg
    c:\clipsal\piced\projects\wheeler\pic0005.jpg
    c:\clipsal\piced\projects\wheeler\pic0006.jpg
    c:\clipsal\piced\projects\wheeler\pic0007.jpg

    Can you test on a unit there?.
    Also have look at the help file for "DrawImage" talks about drawtext - typo

    Dave
    The Envelope Pusher
     
    Last edited by a moderator: Nov 8, 2006
    Dave Byron, Nov 8, 2006
    #3
  4. Dave Byron

    Darren Senior Member

    Joined:
    Jul 29, 2004
    Messages:
    2,361
    Likes Received:
    0
    Location:
    Adelaide, South Australia
    Good.

    In this particular case, it will be necessary to use all of the images in the project (not logic) so that they will get loaded. Images which are only referenced from logic do get loaded and archived, but in this case, you aren't actually referring to each image in the code. Only the first one "pic0000.jpg" is being specifically referenced.

    Fixed.

    I like your new designation :)
     
    Darren, Nov 8, 2006
    #4
  5. Dave Byron

    Dave Byron

    Joined:
    Aug 3, 2004
    Messages:
    835
    Likes Received:
    0
    Location:
    Casurina
    New envolope, Graph Transition in DrawImage
    Need an extra opion to have the above effect without having to load a blank page and then switch to get a page transition effect - just stay on same page and change image.
    Piced version 9 i think ??

    Got a work around, added
    ClearScreen;
    ShowPage("Photo");
    DrawImage(0, 0, "pic0000.jpg" + Photocnt, true);

    thinks its a differnet page and does the transition.



    dave
     
    Last edited by a moderator: Nov 8, 2006
    Dave Byron, Nov 8, 2006
    #5
  6. Dave Byron

    Darren Senior Member

    Joined:
    Jul 29, 2004
    Messages:
    2,361
    Likes Received:
    0
    Location:
    Adelaide, South Australia
    Very clever.
     
    Darren, Nov 10, 2006
    #6
  7. Dave Byron

    ICS-GS

    Joined:
    Nov 1, 2004
    Messages:
    347
    Likes Received:
    0
    Location:
    SE Melbourne
    Dave, you the man!. Have an application where the client wants something like this. Looked at it but did not have the time to work out the finer points...yet.

    Where do i send the A3 envelope ? (you deserve the upgrade):cool:
     
    ICS-GS, Nov 10, 2006
    #7
  8. Dave Byron

    Dave Byron

    Joined:
    Aug 3, 2004
    Messages:
    835
    Likes Received:
    0
    Location:
    Casurina
    ICS-GS
    Put in small change for Darren he has to do the help file write up.

    dave
     
    Last edited by a moderator: Nov 10, 2006
    Dave Byron, Nov 10, 2006
    #8
  9. Dave Byron

    ICS-GS

    Joined:
    Nov 1, 2004
    Messages:
    347
    Likes Received:
    0
    Location:
    SE Melbourne
    i guess... i think i would rather bang my head against a wall than have to write comprehensive help files.
     
    ICS-GS, Nov 12, 2006
    #9
  10. Dave Byron

    Phil.H

    Joined:
    Jul 29, 2004
    Messages:
    466
    Likes Received:
    0
    Location:
    Sydney
    Our much loved Darren is a machine when it comes to writing help and FAQ files... ;)
     
    Phil.H, Nov 23, 2006
    #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.