Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2011-01

Event handling example project

6 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Michael Schnell

I did a small example project (in fact an enhancement of the example/messages/uasynccall.pas example in the svn).

Same lets you select to test

- TThread.Synchronize
- TThread.Queue
- PostMessage
- PostThreadMessage
- SendMessage
- TForm.Dispatch
- Application.QueuAsyncCall without parameters and
- Application.QueuAsyncCall with parameters

From
- A thread
- A timer event and
- A button event

If anybody might be inclined to put this project into the examples directory in the svn, I'd be happy to send the code.

-Michael

Reply by email

zeljko
to Michael Schnell
Michael Schnell wrote 21 lines
I did a small example project (in fact an enhancement of the example/messages/uasynccall.pas example in the svn). Same lets you select to test - TThread.Synchronize - TThread.Queue - PostMessage - PostThreadMessage - SendMessage - TForm.Dispatch - Application.QueuAsyncCall without parameters and - Application.QueuAsyncCall with parameters From - A thread - A timer event and - A button event If anybody might be inclined to put this project into the examples directory in the svn, I'd be happy to send the code.

And where is that example project ?

zeljko

Reply by email

Michael Schnell
to Michael Schnell: I did a small example project (in fact an enhancement of the…

Some testing results with Lazarus revision 29134 and fpGUI revision as of 20110120:

GTK2 fpGUI
From a Thread ======= =======
Synchronize (*) OK
PostMessage OK no function SendMessage (**) no function Dispatch (**) (***)
QueueAsyncCall (*) (****)

From a Timer
Synchronize impossible
PostMessage OK no function SendMessage OK no function Dispatch OK OK
QueueAsyncCall OK (*****)

(*) The scheduled Events only are handled in the Main Thread when GUI
Events for the Form are handled
(**)    Forbidden but eventually works, The scheduled Events only are
handled in the Main Thread when GUI Events for the Form are handled
(***)   Forbidden; works doe some time, then "SIGABRT"
(****)  The scheduled Events only are handled in the Main Thread when
the worker thread is terminated
(*****)Very funny: The scheduled Events only are handled in the Main
Thread when e.g a completely unrelated worker thread is created and then
terminated

Hope this helps,

-Michael

Reply by email

José Mejuto
to Michael Schnell

Hello Lazarus-List,

Thursday, January 20, 2011, 10:47:41 AM, you wrote:

MS> Some testing results with Lazarus revision 29134 and fpGUI revision as MS> of 20110120:
MS> GTK2 fpGUI MS> From a Thread ======= ======= MS> Synchronize (*) OK
MS> PostMessage OK no function MS> SendMessage (**) no function MS> Dispatch (**) (***) MS> QueueAsyncCall (*) (****) MS> From a Timer
MS> Synchronize impossible
MS> PostMessage OK no function MS> SendMessage OK no function MS> Dispatch OK OK
MS> QueueAsyncCall OK (*****)

May you send me the test in order to test PostMessage and SendMessage at least under LCLfpGUI ? As you know it is very alpha :)

Your test invironmen is Linux or Windows ?

Best regards, Jos?

Reply by email

Michael Schnell
to José Mejuto
Jos? Mejuto wrote
May you send me the test in order to test PostMessage and SendMessage at least under LCLfpGUI ?

Done

As you know it is very alpha :)

Of course I know that, so I'm trying to help to improve it. (But as you see the gtk2 Widget Type does not work perfectly, either ;) )

Your test invironmen is Linux or Windows ?

Linux, but the test program should work with Windows, as well. Here additionally, SendThreadMessage should automatically be enabled.

BTW it's an LCL-fpGUI project :).

-Michael

Reply by email