How to do it: what - progressbar, on pressing the button, worked without stopping and after the end of the cycle - fill the progress bar at 100% and stop. ?

In the code:

Min and Max are properties responsible for a range of values.

Position - the position at which the indicator is currently located.

i is a variable for iterating over integers.

Label indicates which number is currently being processed.

procedure TForm1.Button1Click(Sender: TObject); var i, proc, Max : integer; begin Max := 50000; for i:=0 to Max do begin proc := ((i * 100) div Max); Label1.Caption := IntToStr(i); ProgressBar1.Position := proc ; Application.ProcessMessages; // Тут нужный цикл ........................................................ ......................................................... // И после окончания цикла - заполнить прогресс бар на 100% и остановить. end; end; 

That is, in simple words, saying - Make an "endless" progress bar, which simply shows that the download process is going on and stop it after the end of the cycle.

  • one
    You need the value of the progress bar to calculate and update inside blossomed - JVic
  • @JVic, And if, simply, to make it endless, at the beginning of the cycle and at the end just stop? That is, what would he, just for the sake of view, showed that the process is underway. - Tatiana
  • one
    then just before the proc := 0; inside an inc(proc); ProgressBar1.Position := proc ; loop inc(proc); ProgressBar1.Position := proc ; inc(proc); ProgressBar1.Position := proc ; You can also add zeroing if (proc = 100) then poc = 0; - JVic
  • @JVic, Thanks, it turned out. But to tell the truth, the speed of work, for this, has fallen. - Tatiana
  • one
    update the progress if (i div 100) then обновить бар every hundred iterations if (i div 100) then обновить бар - JVic

1 answer 1

I recommend using the Smooth property, with true or false values ​​depending on what you need, this mode is designed specifically for such cases as yours!