## Selects randomly an image from the image list and loades it

Please post bug reports, feature requests, or any question regarding the DELPHI AREA projects here.

### Selects randomly an image from the image list and loades it

Hallo,

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

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
drschubi
Member

Posts: 4
Joined: August 20th, 2003, 4:48 pm

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;

Regards,
Kambiz

Kambiz

Posts: 2430
Joined: March 7th, 2003, 7:10 pm

### Show Pictures from

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
var
Index: Integer;
begin
if Pictures.Count > 0 then
begin
repeat
Index := Random(Pictures.Count); //What must I change there ???
until (Pictures.Count <= 1) or (ShownImage <> Pictures[Index]);
end;
NextFilename.Caption := 'Next: ' + LoadedImage;
NextFilename.Update;
findwort;
end;
drschubi
Member

Posts: 4
Joined: August 20th, 2003, 4:48 pm

In the attachment you can find the main unit of the demo, which is adapted for your purpose.

Kambiz

Posts: 2430
Joined: March 7th, 2003, 7:10 pm

### Thank you very much, I am so happyy

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é
drschubi
Member

Posts: 4
Joined: August 20th, 2003, 4:48 pm