[Lazarus] LCL messaging system SendMessage and Multi-Threads

Michael Schnell mschnell at lumino.de
Fri May 7 16:59:51 CEST 2010


On 05/07/2010 04:21 PM, Andrew Brunner wrote:
>  But it is a necessity for doing GUI work since
> Gnome or GTK2
> won't accept visibility changes from outside threads...
>   
AFAIK as well with Delphi as with all LCL GUI Widgetr types accessing
the GUI from a worker thread is forbidden. But of course you don't need
to use "synchronize" to have the main thread change the visibility. you
can use any means available to notify the main thread from the worker
thread. E.g a global variable the main thread thread watches or using
PostMessage().
> SendMessage did not work.  Visibility as not able to be changed.  Only
> synchronize worked.
>   
As already said, in Linux SendMessage (other that PostMessage) is not
implemented (or possible to be implemented) in a way that adheres to the
Windows API description. So I would not use it at all, as it's not
documented in any way.
> Thanks for your insight - solved the issue in like the first 10 minutes ;-)
>   
Great !

-Michael




More information about the Lazarus mailing list