Slide Show

This uses the techniques and commands used in List Files and Loading Pictures to present a slide show of graphics images. It identifies all .mbm files in a folder and then proceeds to display them one after the other. Not only that, but it also displays multiple images stored within .mbm files.

The first procedure gets the filenames one by one (see List Files) and the second loads and displays the images (see Load Picture). The only bit that should be new is the Onerr quit command. I don't know how many images are stored in a .mbm file and I don't know how to find out. so, I just keep on trying to display them until I get an error. The error means that there are no more images and the Onerr quit jumps to the end of the showpic: procedure.

One minor point is that I'm jumping out of a Do...Until loop. Some Basic interpreters don't like this, but I've not had any complaints from OPL yet. Perhaps if you did it a thousand times you'd run out of memory, but in this little program it's OK. You could always replace the Do with a label and the Until 0 with a Goto. It would solve the problem, but I hate Goto.

This program is pretty much like those shareware/freeware mbm viewers. All you need to add is a way of selecting the folder to view and you've got yourself a neat little program.

PROC SlideShow:
Local f$(255)
f$=Dir$("c:\*.mbm")
While f$<>""
  showpic:(f$)
  f$=Dir$("")
Endwh
Defaultwin 1
ENDP

PROC showpic:(file$)
Local i%,j%
j%=0
Do
  Defaultwin 2
  Onerr quit
  i%=gloadbit(file$,0,j%)
  gUse 1
  gCopy i%,0,0,640,240,0
  gClose i%
  At 1,21 : Print file$;"(";j%;")";
  j%=j%+1
  Get
Until 0
quit::
Onerr Off
ENDP
 

Back to RAW Computing

  Psion home page