threads and memos - blocking though synchronized..

   It seems that the original message hasn't quite arrived where I am yet,

>Jan Rosinowski wrote:

>> hi,

>> i've written a small, mutlithreaded d2-application which uses one
>> thread to log the other threads' results. the problem: the main-thread
>> (or program) locks, if i add a message to a memo on a pagecontrol thru
>> the synchronized dosync-procedure of my logthread.

    Pay close attention to what Delphi tells you -- from TThread help :

 "Any methods that access a VCL component and update a form must only be
called from within the main VCL thread"

    Which, if you need translation, means you can't touch the screen from
spawned threads. TThread comes with a suitably unusable function to solve
this problem : "synchronize".
    If you want to pass any variables to the function that you're
synchronizing, I'd suggest POSTing a windows message to the form that you're
modifying. You can pack 6-8 bytes (depending on the OS...) of static info or
pointers into a message record.

    Speaking of which, does anyone know how to handle this problem on a
higher level?  This technique gets very redundant if you do a lot of this,
but I have not been able to come up with anything else.

P.S. I'm moving this thread along to "MISC" where IT RIGHTFULLY BELONGS. Pay
attention to these things, eh? And please don't follow up to both groups.