I'm trying to write a procedure that goes thru a directory and grab the name and extension of the pictures in the directory.
The program will cycle through the images every few seconds much like a slide show.
The problem I'm having is that when the object is getting added to the list, it keeps adding the last image. So when I run the program the last images is just showing.
Global picsTList:TList = New TList
LoadImages()
For Local p:TMyPictures = EachIn picsTList
Cls
DrawImage(p.pics, 0, 0, 0)
Flip
Delay(2000)
Next
Function LoadImages:TImage ()
'load images from dir
Local files:String[]
Local t:TMyPictures = New TMyPictures
files = LoadDir("images")
' load images in array
For Local str:String = EachIn files
t.pics = LoadImage("images\" + str)
t.picPath = "images\" + str
picsTList.AddLast(t)
Next
End Function
Type TMyPictures
Field pics:TImage
Field picPath:String
End Type
|