Not sure what you really want to do. Here I wrote a simple example showing how to show the value of a global variable:
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Forms, Dialogs, ComCtrls, StdCtrls, ExtCtrls;
type
{ TForm1 }
TForm1 = class(TForm)
Button1: TButton;
Label1: TLabel;
Memo1: TMemo;
RadioGroup1: TRadioGroup;
StatusBar1: TStatusBar;
Timer1: TTimer;
procedure Button1Click(Sender: TObject);
procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
procedure FormCreate(Sender: TObject);
procedure RadioGroup1Click(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
end;
var
Form1: TForm1;
Data: Integer = 0;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.FormCreate(Sender: TObject);
begin
RadioGroup1.Visible := False;
Label1.Visible := False;
Memo1.Visible := False;
StatusBar1.Visible := False;
Timer1.Enabled := False;
Timer1.Interval := 100;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
RadioGroup1.Visible := True;
Timer1.Enabled := True;
Button1.Visible := False;
end;
procedure TForm1.FormClose(Sender: TObject; var CloseAction: TCloseAction);
begin
Timer1.Enabled := False;
end;
procedure TForm1.RadioGroup1Click(Sender: TObject);
begin
Label1.Visible := RadioGroup1.ItemIndex = 0;
Memo1.Visible := RadioGroup1.ItemIndex = 1;
StatusBar1.Visible := RadioGroup1.ItemIndex = 2;
if RadioGroup1.ItemIndex = 3 then
begin
RadioGroup1.ItemIndex := -1;
ShowMessage(Data.ToString);
end;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
var
S: string;
begin
Inc(Data);
S := Data.ToString;
case RadioGroup1.ItemIndex of
0: Label1.Caption := S;
1: begin
Memo1.Clear;
Memo1.Append(S);
end;
2: StatusBar1.SimpleText := S;
end;
end;
end.
It uses a TTimer to change the value of the Data. Usually we use a TLabel to show data, not TEdit. But if you want to 'see' the data if it changed you can use a TTimer - not the best but it works for most cases. The 'better' solution is put the code on the location there it changed.
I saw you put it on the TEdit OnChanged and you show the data on the TEdit.Text. It is wrong. As mentioned by @howardpc, it can cause unexpected result.
What is the thing you really want to achieve? If it is for debugging purpose you may use
ShowMessage, which is my preference. Sometimes, I use a statusbar or form's caption.
The example is a gui project, it won't work if you just copy paste the code. You can download the test.zip if you want to modify and test the code.