Index » Empathy Jukebox : Blob 2c3a4f / getpicture.pas
unit getpicture;

interface

uses
  Classes,graphics,loadjpegorbmp;

type
  tgetpicture = class(TThread)
  private
  fname : string;
  i : integer;
  a : string;

    { Private declarations }
  protected
    procedure Execute; override;
    procedure doit;

  public
    constructor Create(filename : string; imagenumber : integer);
  end;



implementation
uses main;

var count : integer;
constructor tgetpicture.Create(filename : string; imagenumber : integer);
begin


inherited Create(false);
FreeOnTerminate := True;
fname:=filename;
i := imagenumber;
str(albumcount,a);
end;


{ Important: Methods and properties of objects in VCL can only be used in a
  method called using Synchronize, for example,

      Synchronize(UpdateCaption);

  and UpdateCaption could look like,

    procedure killthread.UpdateCaption;
    begin
      Form1.Caption := 'Updated in a thread';
    end; }

{ killthread }

procedure tgetpicture.Execute;
begin
synchronize(doit);
end;

procedure tgetpicture.doit;
var
s : string;
begin
count:=count+1;
str(count,s);
mainform.caption:='Empathy .999 - Please Wait: Loaded '+s+' of '+a;
mainform.thumbspanel.refresh;
try


mainform.thumb[i].canvas.font.color:=clwhite;
loadjpegbmp(fname,mainform.thumb[i].picture);
mainform.thumb[i].refresh;
except
 mainform.thumb[i].picture.bitmap:=nil;
end;
if count=albumcount then mainform.caption:='Empathy .999';
end;

end.