unit Thread_Syn;
interface
uses
System.SysUtils, System.Types, System.UITypes, System.Classes,
System.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.StdCtrls,
IdBaseComponent, IdThreadComponent, FMX.Layouts, FMX.ListBox;
type
TForm1 =
class(TForm)
Button1: TButton;
IdThreadComponent1: TIdThreadComponent;
Label1: TLabel;
procedure IdThreadComponent1Run(Sender: TIdThreadComponent);
procedure Button1Click(Sender: TObject);
end;
var
Form1: TForm1;
implementation
{$R *.fmx}
procedure TForm1.Button1Click(Sender: TObject);
begin
IdThreadComponent1.Start;
end;
procedure TForm1.IdThreadComponent1Run(Sender: TIdThreadComponent);
var
Text:
String;
begin
Text := '
Test!!';
IdThreadComponent1.Synchronize(
procedure
begin
Label1.Text := Text;
end);
IdThreadComponent1.Stop;
end;
end.