Message: 4
Date: Sun, 8 Nov 2015 12:33:42 -0500
From: Anthony Walter <[email protected]>
Subject: Re: [Lazarus] Event created by program logic rather than user
action
To: Lazarus mailing list <[email protected]>
Message-ID:
<CAHmPLWXfCM=pSGt1w1=GJuD2bA9=53pqagdhl1f-bt-yxfu...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

Here's an example which calculates Pi forever in a thread. It's important
to note a few things:

1. Periodically check if the thread should stop by checking the Terminated
property inside Execute
2. If you want to communicate with the user interface, such as refreshing
the screen based on some calculations, use the Synchronize method to do so
3. Do not share data the thread is using in calculations with anything. If
you need access to the data in somewhere else, use Synchronize and make a
copy there.
 
Hi,
 
as far as I can see the only advantage of running the math-routine in a thread
would be that the program could be terminated at any time, rather than only
in the main loop.
 
Even if one did it like that, the original problem remains: who is the sender
in the FormPaint call?
 
Sincerely
 
Engelbert
--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to