Forum > Beginners

Lazarus - TGifAnim.

(1/1)

seghele0:
I'm using the 'Wile64' component = TGifAnim.
How can I make the 'GifAnim' disappear after 5 seconds?
 ::)

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---unit Unit1;{$mode objfpc}{$H+}interfaceuses  Classes, SysUtils, Forms, Controls, Graphics,  Dialogs, ExtCtrls, Buttons, GifAnim;type  TForm1 = class(TForm)    GifAnim1: TGifAnim;    SpeedButton1: TSpeedButton;    procedure SpeedButton1Click(Sender: TObject);  private  public  end;var  Form1: TForm1; implementation{$R *.lfm} procedure TForm1.SpeedButton1Click(Sender: TObject);begin  GifAnim1.Animate:= True;  GifAnim1.FileName:= 'test1.gif';end; end.                          

speter:
In addition to jamie's comments... set the image's visible property to false.

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---GifAnim1.visible := false;
cheers
S.

seghele0:
After a lot of searching and trying again ( %)), I probably found a solution.

Can my code be made even more efficient?
Thanks in advance.
 ;)

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---unit Unit1;{$mode objfpc}{$H+}interfaceuses  Classes, SysUtils, Forms, Controls, Graphics,  Dialogs, ExtCtrls, Buttons, StdCtrls,  GifAnim;type   TForm1 = class(TForm)    GifAnim1: TGifAnim;    LblCountdown: TLabel;    PanelGIF: TPanel;    SpeedButton1: TSpeedButton;    Timer1: TTimer;     procedure SpeedButton1Click(Sender: TObject);    procedure Timer1Timer(Sender: TObject);   private       VARstart: integer;   public    //  end;var  Form1: TForm1; implementation{$R *.lfm}procedure TForm1.SpeedButton1Click(Sender: TObject);begin  PanelGIF.Visible:= True;  GifAnim1.Animate:= True;  GifAnim1.FileName:= 'test1.gif';  Timer1.Enabled := True;  Timer1.Interval := 1000;  LblCountdown.Caption := '';  VARstart := 5;end; procedure TForm1.Timer1Timer(Sender: TObject);begin  LblCountdown.Caption := Format('%d',[VARstart]);  Dec(VARstart);  if (VARstart < 0) then  begin    Timer1.Enabled := False;    LblCountdown.Caption := 'Finished';    PanelGIF.Visible:= False;  end;end;end.              

Navigation

[0] Message Index

Go to full version