Topic: Need Help with Loading Gif

I have created a screen with a power button and would like the Gif to load as if the screen has been turned on, I have been able to load one Gif on all forms with on open command, but can not get it to load from button press, I have tried gif that runs once and one on a loop and can not get it to run. any help is appreciated.

Thanks

Post's attachments

Attachment icon Play Screen Gif.zip 710.95 kb, 44 downloads since 2021-08-03 

Re: Need Help with Loading Gif

Hello Just4Fun
Can it help you ?

procedure frm_main_OnShow (Sender: String; Action: string);
begin
     Form1.Panel1.DoubleBuffered := True;                                                                                              // Empêche le scintillement
     fForm1.Image1.Picture.LoadFromFile(ExtractFilePath(Application.ExeName)+'Images\gif.gif');      // On récupère le GIF
     Form1.Image1.AutoSize := True;
     TGIFImage(frm_main.Image1.Picture.Graphic).Animate := True;                                                      // On active l'animation
     TGIFImage(frm_main.Image1.Picture.Graphic).AnimationSpeed:= 500;                                           // On ajuste la vitesse
end;

JB

Re: Need Help with Loading Gif

Thanks JB  This is only my second go at using MVD so I am probably doing a lot of thing wrong.
I have managed to now get the Gif to run with a Panel But now will no longer hide the panel after set time. Do you know if there is another timer i can use to close the Panel.
I have attached another copy, where as the first up load the image would close but would not run the gif,
Now i can run the gif but not close / hide the panel. If you run the sample then remove the // from my code will see what i mean.
Thanks for you help

Post's attachments

Attachment icon Play Screen Gif V2.zip 693.82 kb, 36 downloads since 2021-08-04 

4 (edited by derek 2021-08-04 22:05:57)

Re: Need Help with Loading Gif

Hi Just4Fun, Salut Jean (j'espère que toi et ta famille allez bien),
Rather than use another timer just to close the panel, it might be easier to do the whole thing (display the panel, image, wait for nn seconds and then close the image and panel) on another timer (I've used 'timer2' which you'd already defined in your script although there was no code for it).
One other thing you might want to consider is putting all your 'futurebuttons' on a panel;  objects placed on a panel are subordinate to the panel so you can just make the panel hidden or visible with one line of code (and all objects on the panel (ie your 'futurebuttons') also become hidden or visible (it saves a lot of time when writing the script);  note that existing objects on a form can't be dragged onto a panel - they need to be cut and then pasted.
Regards,
Derek.

Post's attachments

Attachment icon Play Screen Gif V2 fixed.zip 694.74 kb, 75 downloads since 2021-08-04 

Re: Need Help with Loading Gif

Thank you Derek that’s exactly what I was after, as I said this is my second database that I am building. I have no experience with databases or with coding so lots of searching the forum and copying bits and pieces from other samples. I am slowly picking up things here and there but have a long way to go. I really appreciate and welcome feedback and suggestions, I will look at placing my buttons on panels as that makes sense.
Thanks again and also thanks JB. One thing that makes a great program better is the MVD community.