VCL components should only be manipulated from the main thread context.
TThread.Synchronize() provides this service for thread methods.
>From your thread, call Synchronize(DisplayResponse) rather than
DisplayResponse on its own.
Paul.
At 11:31 16/07/01 , you wrote:
>Hello All,
>
>I have a form with my component on it. The component uses Indy's IdTCPClient
>and runs series of transactions in threads (not TIdThread but TThread). For
>testing purposes I need to be able to see the results of communication
>between my client and a TCP/IP server. When I run the following code on the
>component level it all works fine:
>
>//TTransactionManager is a non-visual component
>procedure TTransactionManager.DisplayResponse(sResponse: String);
>var
> i : Integer;
>begin
> for i := 0 to Application.MainForm.ComponentCount - 1 do begin
> if Application.MainForm.Components[i] is TMemo then begin
> (Application.MainForm.Components[i] as TMemo).Lines.Add(sResponse);
> break;
> end;
> end;
>end;
>
>But if I run it within a thread as:
>
>// called from critical section
>procedure TTransactionThread.DisplayResponse;
----------------------------------------------------------
Paul Spain, Excellent Programming Company
mailto:[EMAIL PROTECTED]
----------------------------------------------------------
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/