09-30-2022, 04:00 PM
(This post was last modified: 09-30-2022, 04:01 PM by jeroen.rottink.)
Hi Eddy,
That is because first you clear the lines resulting in Text = ''. After that you assign it the new text.
The same would be
begin
MyText.Text := '';
MyText.Text := 'My awesome text';
end;
When you write a 'Setter' for a property it is good practice to do:
procedure TMyClass.SetText(const AValue: string);
begin
if (FText <> AValue)
then begin
FText := AValue;
DoSomeChangeAction;
end;
end;
Hope this makes sense.
That is because first you clear the lines resulting in Text = ''. After that you assign it the new text.
The same would be
begin
MyText.Text := '';
MyText.Text := 'My awesome text';
end;
When you write a 'Setter' for a property it is good practice to do:
procedure TMyClass.SetText(const AValue: string);
begin
if (FText <> AValue)
then begin
FText := AValue;
DoSomeChangeAction;
end;
end;
Hope this makes sense.

