Michael Schnell wrote:
For the record:

I verified that with the gtk2 (Linux) Widget type, "PostMessage()" uses a different Event Queue ("TGTKMessageQueue") than "TThread.Queue()" and TThread.Synchronize()".

So for this, calling "CheckSynchronize() will not help. You need to use the appropriate GUI-based Widget type.

Thanks for that, useful. That's going to impact anybody trying to convert code that uses custom Windows messages to pass events around.

Application.QueuAsyncCall() uses yet an additional Event Queue. Here using a WidgetType is not strictly necessary, but calling "CheckSynchronize() will not help, either. Here, TApplication provides "RemoveAsyncCalls()" which in a GUI Bases Widget Type is called in "Forms". As a non-GUI Project does not have Forms, RemoveAsyncCalls() needs to be called by a different functionality.

I don't think I've used QueueAsyncCall() in the context of a non-GUI program. Where I do find it useful is when converting an interactive non-GUI (i.e. console) program into a Lazarus GUI app: enqueue an async call in the main form's FormCreate() with the payload being e.g. a looping interactive command interpreter which calls Application.ProcessMessages when it's got nothing to do.

--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]

--
_______________________________________________
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to