Let the form register a callback event in your class.
If this event is assigned when adding an item to your list, use the callback to send the string.
Type
TMyCallback = procedure(const aLogStr: String) of object;
TMyClass = Class
private
FCallback : TMyCallback;
FLogFile : TStringList;
procedure SetCallback(ACallback: TMyCallback);
public
property Callback : TMyCallback write SetCallback;
end;
...
// Update FLogFile
FLogFile.Items.Add(SomeText);
if Assigned(FCallback) then
FCallBack(SomeText);
...
In your form class:
Type
TMyForm = Class(TForm)
private
procedure IncomingLogString(const AStr: String);
end;
procedure TMyForm.IncomingLogString(const AStr: String);
begin
MyMemo.Lines.Add(AStr);
end;
...
// Register callback
FMyClass.Callback := Self.IncomingLogString;
Now, your TMyClass
is decoupled from any dependence from the form.