In Delphi 10.2, I have a Form A that has a "Task-A" TTask that triggers a StoredProcedure in the Oracle database with Firedac. The StoredProcedure updates a result table that will be used by a form B which has a graph. I would like to call Form B inside a TTask "B-Task", which calls the Forms B with the graph and can return to Form A, while the graph keeps updating in the other forms B! I used the following command to open Form B inside a TTask, BUT FREEZE THE APPLICATION! Thanks for the personal help!
procedure TFormA.SpeedButtonChamaGrafico(Sender: TObject);
var
Tarefaproc, Tarefagrafico : iTask;
begin
// Chamada da StoredProcedure dentro da TTask ==> funciona corretamente !!
Tarefaproc := TTask.Create( procedure ()
begin
with FDStoredProc1 do
begin
Prepare;
Params[0].Value := StrToInt(EditCenario.Text);
Execproc;
end;
end);
Tarefaproc.Start;
// Logo em seguida, chamada do FormB dentro de outra TTASK ==> DÁ ERRO, congela a aplicação !!
Tarefagrafico := TTask.Create( procedure ()
begin
try
Application.CreateForm(TformB,FormB);
FormB.ShowModal;
finally
Freeandnil(formB);
end;
end);
Tarefagrafico.Start;