Page 1 of 1

Selects randomly an image from the image list and loades it

PostPosted: August 20th, 2003, 4:57 pm
by drschubi
Hallo,

at first thank you for picshow, my english is not so good, but i want try to ask. :oops:

I don't want randomize the picshow, i want see the picshow in turn.
It is possible to implement this funktion in your component , and then the user can change it from the form or you can me tell, how I must change the democode below the comment in my subject.

Sorry for my very bad english. I hope somebody understand me. Maybe in german.

Thank you veryy much

PostPosted: August 21st, 2003, 8:02 pm
by Kambiz
Hi,

PicShow just get one single image to display and doesn't manage a list of images. It's the developer responsibility to feed the images to the component as she/he wants. When OnStart event of PicShow is triggered, the component doesn't need the image anymore and after that you can assign a new image to the Picture property.

I think you want to show a list of image files to the user, and when user selects one image, you display it. For this purpose you code should be something like this:

Code: Select all
if PicShow.Busy then
  PicShow.Stop;
PicShow.Picture.LoadFromFile(Path_To_Image_File);
PicShow.Execute;

I hope I could answer to your question.

Regards,
Kambiz

Show Pictures from

PostPosted: August 22nd, 2003, 2:01 pm
by drschubi
Hi Kambiz,

thank you very much for your answer, but I want only show the images from the created filelist in turn.
When I delete the "random" in this code below, I get an error.

I want show e.g. pic01.jpg then pic02.jpg and not random. Sorry for my english, but I am a beginner in english and Delphi.

// Selects randomly an image from the image list and loades it into PicShow
procedure TMainForm.LoadNextImage;
var
Index: Integer;
begin
LoadedImage := EmptyStr;
if Pictures.Count > 0 then
begin
repeat
Index := Random(Pictures.Count); //What must I change there ???
until (Pictures.Count <= 1) or (ShownImage <> Pictures[Index]);
LoadedImage := Pictures[Index];
PicShow.Picture.LoadFromFile(PicPath + LoadedImage);
end;
NextFilename.Caption := 'Next: ' + LoadedImage;
NextFilename.Update;
findwort;
end;

PostPosted: August 22nd, 2003, 6:06 pm
by Kambiz
In the attachment you can find the main unit of the demo, which is adapted for your purpose.

Thank you very much, I am so happyy

PostPosted: August 22nd, 2003, 6:50 pm
by drschubi
Hello Kambiz,

that is very nice from you, this is exactly what I want. I will try to learn from your code. Many thanks and best wishes from Germany.


Best regards

René