Selects randomly an image from the image list and loades it

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

Selects randomly an image from the image list and loades it

Postby drschubi » August 20th, 2003, 4:57 pm

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
drschubi
Member
Member
 
Posts: 4
Joined: August 20th, 2003, 4:48 pm

Postby Kambiz » August 21st, 2003, 8:02 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;

I hope I could answer to your question.

Regards,
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2405
Joined: March 7th, 2003, 7:10 pm

Show Pictures from

Postby drschubi » August 22nd, 2003, 2:01 pm

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;
drschubi
Member
Member
 
Posts: 4
Joined: August 20th, 2003, 4:48 pm

Postby Kambiz » August 22nd, 2003, 6:06 pm

In the attachment you can find the main unit of the demo, which is adapted for your purpose.
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2405
Joined: March 7th, 2003, 7:10 pm

Thank you very much, I am so happyy

Postby drschubi » August 22nd, 2003, 6:50 pm

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
Member
 
Posts: 4
Joined: August 20th, 2003, 4:48 pm


Return to DELPHI AREA Products

Who is online

Users browsing this forum: Google [Bot] and 2 guests

cron