Recent

Author Topic: ProgressBar problem  (Read 11777 times)

a.atalla

  • Jr. Member
  • **
  • Posts: 82
ProgressBar problem
« on: May 25, 2010, 03:34:57 am »
 i have a text file each line in it contains a path to a file and i make  code to copy files from those paths to another place and a progress-bar to indicate the copying process but the progress bar doesn't move  any help ?

Code: [Select]
     sl:=TStringList.Create; sl.LoadFromFile('/tmp/rpms.txt');
     Progressbar1.Max := sl.Count;    //set the pbar max equal no of lines in the rpm.txt
     sl.Free;
     AssignFile(rpmsFile,'/tmp/rpms.txt');
     Reset(rpmsFile);
     while not  EOF(rpmsFile) do
           begin
           ReadLn(rpmsFile,rpm);
           rpm1 := ExtractFileName(rpm);
           CopyFile(rpm,'/tmp/yumoncd/packages/'+rpm1);
           Progressbar1.Position:= Progressbar1.Position + 1;
           end;                 
Lazarus 1.0.8 | FPC 2.6.2 x64  | Arch Linux x64 | Windows 7-x86

theo

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1927
Re: ProgressBar problem
« Reply #1 on: May 25, 2010, 03:53:05 am »
...
Progressbar1.Position:= Progressbar1.Position + 1;
Application.Processmessages;
...

a.atalla

  • Jr. Member
  • **
  • Posts: 82
Re: ProgressBar problem
« Reply #2 on: May 25, 2010, 03:59:23 am »
great it works   :)
what did this line do ????
Lazarus 1.0.8 | FPC 2.6.2 x64  | Arch Linux x64 | Windows 7-x86

theo

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1927

a.atalla

  • Jr. Member
  • **
  • Posts: 82
Re: ProgressBar problem
« Reply #4 on: May 25, 2010, 07:23:43 am »
thanks alot
Lazarus 1.0.8 | FPC 2.6.2 x64  | Arch Linux x64 | Windows 7-x86

 

TinyPortal © 2005-2018