|
Tela
Programa cria 10 registros dentro de uma thread e coloca num TListView:

Fonte
const
MaxValue = 1000;
begin
TThread.CreateAnonymousThread(procedure ()
var
I: Integer;
Total: Integer;
begin
Total := 0;
for I := 1 to MaxValue do
begin
if (I * 10 mod MaxValue) = 0 then
TThread.Synchronize (TThread.CurrentThread,
procedure ()
begin
ListView1.Items.Add.Text := 'Th: ' + I.ToString;
end);
Inc(Total);
end;
TThread.Synchronize (TThread.CurrentThread,
procedure ()
begin
ListView1.Items.Add.Text := 'Thread: ' + Total.ToString;
//NotifyComplete;
end);
end).Start;
end;
|