<html><head></head><body><div style="font-family: Verdana;font-size: 12.0px;"><div> 
<div> 
<div name="quote" style="margin:10px 5px 5px 10px; padding: 10px 0 10px 10px; border-left:2px solid #C3D9E5; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Message: 4
<div name="quoted-content">Date: Sun, 8 Nov 2015 12:33:42 -0500<br/>
From: Anthony Walter <sysrpl@gmail.com><br/>
Subject: Re: [Lazarus] Event created by program logic rather than user<br/>
action<br/>
To: Lazarus mailing list <lazarus@lists.lazarus.freepascal.org><br/>
Message-ID:<br/>
<CAHmPLWXfCM=pSGt1w1=GJuD2bA9=53pQaGdhL1f-bT-yXfu6_Q@mail.gmail.com><br/>
Content-Type: text/plain; charset="utf-8"<br/>
<br/>
Here's an example which calculates Pi forever in a thread. It's important<br/>
to note a few things:<br/>
<br/>
1. Periodically check if the thread should stop by checking the Terminated<br/>
property inside Execute<br/>
2. If you want to communicate with the user interface, such as refreshing<br/>
the screen based on some calculations, use the Synchronize method to do so<br/>
3. Do not share data the thread is using in calculations with anything. If<br/>
you need access to the data in somewhere else, use Synchronize and make a<br/>
copy there.</div>

<div name="quoted-content"> </div>

<div name="quoted-content">Hi,</div>

<div name="quoted-content"> </div>

<div name="quoted-content">as far as I can see the only advantage of running the math-routine in a thread</div>

<div name="quoted-content">would be that the program could be terminated at any time, rather than only</div>

<div name="quoted-content">in the main loop.</div>

<div name="quoted-content"> </div>

<div name="quoted-content">Even if one did it like that, the original problem remains: who is the sender</div>

<div name="quoted-content">in the FormPaint call?</div>

<div name="quoted-content"> </div>

<div name="quoted-content">Sincerely</div>

<div name="quoted-content"> </div>

<div name="quoted-content">Engelbert</div>
</div>
</div>
</div></div></body></html>