Delphi throbber -


what best solution show application doing something?

i tried showing progress indicator, did not work.

update: -------------

a progress bar works fine, isn't want.

i want show throbber, web browsers use, long being updated keeps turning.

cursor can in crhourglass mode.

try this:

animateunit

unit animateunit;  interface  uses   windows, classes;  type   tframeproc = procedure(const theframe: shortint) of object;    tframethread = class(tthread)   private     { private declarations }     fframeproc: tframeproc;     fframevalue: shortint;     procedure synchedframe();   protected     { protected declarations }     procedure frame(const theframe: shortint); virtual;   public     { public declarations }     constructor create(theframeproc: tframeproc; createsuspended: boolean = false); reintroduce; virtual;   end;    tanimatethread = class(tframethread)   private     { private declarations }   protected     { protected declarations }     procedure execute(); override;   public     { public declarations }   end;  var   animatethread: tanimatethread;  implementation  { tframethread } constructor tframethread.create(theframeproc: tframeproc; createsuspended: boolean = false); begin   inherited create(createsuspended);   freeonterminate := true;   fframeproc := theframeproc; end;  procedure tframethread.synchedframe(); begin   if assigned(fframeproc) fframeproc(fframevalue); end;  procedure tframethread.frame(const theframe: shortint); begin   fframevalue := theframe;   try     sleep(0);       synchronize(synchedframe);   end; end;  { tanimatethread } procedure tanimatethread.execute(); var   i: shortint; begin   while (not self.terminated)   begin     frame(0);     := 1 8     begin       if (not self.terminated)       begin         sleep(120);         frame(i);       end;     end;     frame(0);   end; end;  end. 

unit1

unit unit1;  interface  uses   windows, messages, sysutils, variants, classes, graphics, controls, forms,   dialogs, stdctrls, extctrls, imglist;  type   tform1 = class(tform)     imagelist1: timagelist;     image1: timage;     button1: tbutton;     button2: tbutton;     procedure button1click(sender: tobject);     procedure button2click(sender: tobject);   private     { private declarations }   public     { public declarations }     procedure updateframe(const theframe: shortint);   end;  var   form1: tform1;  implementation  uses   animateunit;  {$r *.dfm} procedure tform1.updateframe(const theframe: shortint); begin   image1.picture.bitmap.handle := 0;   try     imagelist1.getbitmap(theframe, image1.picture.bitmap);       image1.update();   end; end;  procedure tform1.button1click(sender: tobject); begin   animatethread := tanimatethread.create(updateframe); end;  procedure tform1.button2click(sender: tobject); begin   animatethread.terminate(); end;  end. 

the images

image1 image2 image3 image4 image5 image6 image7 image8

animate1


Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -