I have a series of TabSheets within a group box. The TabSheets contain 30 TEdit controls. I want to be able to detect changes in the TEdit text (values). My plan was to make a call to a single validation procedure from the EdditingDone event of each TEdit where I could loop through all the components, identify the TEdit and then check the value against the original value.
For testing I have the following code in the EdditingDone event of the first of the many TEdit. I am able to identify a TEdit of interest and the following line works but I want to make it general
x:=StrToFloat(txtPageLayout1.Text);
I would like to do this but it isn't valid, presumably because some controls don't have text? So how can I get the text?
x:=StrToFloat(Components[I].Text);
procedure TfrmMain.txtPageLayout1EditingDone(Sender: TObject);
Var
xOld: Single; //the existing value set for testing
i: Integer;
x: Single;
begin
for I:=0 to ComponentCount - 1 do
if Components[i] is TEdit then
Begin
xOld:=15;
If LeftStr(Components[I].Name,14) = 'txtPageLayout1' Then
Begin
//The control of interest for checking
x:=StrToFloat(txtPageLayout1.Text);
If xOld <> x then ShowMessage('Layout1 was ' + xOld.ToString + ' Changed to ' + x.ToString);
End
end;
end;