I have thread
that I want to update a progress bar at each iteration of a TQuery
for example, however what I noticed is that to perform the query process, I have to put the function that makes select within thread, as an example below:
procedure TGeradorArquivos.GeraArquivo;
var
CaminhoArquivo: String;
Arquivo: TextFile;
begin
Self.Query.Sql.Clear;
Self.Query.Sql.Add('Select * from Teste');
Self.Query.open;
if Self.Query.Recordcount > 0 then
begin
AssignFile(Arquivo,CaminhoArquivo);
Rewrite(Arquivo);
FrmTeste.ProgressBar.Max := Self.Query.RecordCount;
try
while not Self.Query.Eof do
begin
Write(Arquivo,Self.Query.FieldByName('Campo').AsString);
FrmTeste.ProgressBar.StebBy(1);
Self.Query.Next;
end;
finally
CloseFile(Arquivo);
end;
end;
end;
Is there any way to unlink the function to update the progress bar? Ie take the select from this thread and just leave to update the GUI of the form?