I'm trying to increment progressbar
within my repeat structure, but progressbar
always hangs the application. I'll demonstrate here, follow the code:
Would it be correct to try to use this way?
ProgressBar1.Position:=0;
While ... do
begin
DModuleGrid.ZQuery3.Close;
DModuleGrid.ZQuery3.SQL.Clear;
DModuleGrid.ZQuery3.SQL.Add('SELECT count(*) FROM cupatres WHERE numcupom = :pcoo2 ');
DModuleGrid.ZQuery3.SQL.Add('AND NSerie = :pecf1 AND ccf = :pccf3 AND Retorno = :pret4 ');
DModuleGrid.ZQuery3.SQL.Add('AND diavenda BETWEEN "'+pdate1treg+'" AND "'+pdate2treg+'"');
DModuleGrid.ZQuery3.ParamByName('pcoo2').AsString := copy(lTemp,47,6);
DModuleGrid.ZQuery3.ParamByName('pccf3').AsString := copy(lTemp,53,6);
DModuleGrid.ZQuery3.ParamByName('pret4').AsString := copy(lTemp,59,3);
DModuleGrid.ZQuery3.ParamByName('pecf1').AsString := copy(lTemp,4,20);
DModuleGrid.ZQuery3.Open;
DModuleGrid.ZQuery3.FetchAll;
rc1 := DModuleGrid.ZQuery3.RecordCount-1;
ProgressBar1.Max := rc1;
ProgressBar1.Position:= ProgressBar1.Position+1;
Sleep(50);
Application.ProcessMessages;
end;