On Mon, 7 Sep 2020 12:40:07 +0200 (CEST), Michael Van Canneyt via
fpc-pascal
<fpc-pascal@lists.freepascal.org> wrote:

>> Why does the FpTimer event not fire?
>
>Do you call checksynchronize at regular intervals ? The default timer is
>threaded, and the OnTimer event is called in the main thread. For this to
>work, you need to call checksynchronize at regular intervals in your main
>thread.

Before I read your reply I tested another thing:
I dropped a regular timer from the component palette onto the form
intending to use that instead of FpTimer.

So I made an event function by doubleclicking the event as usual and
added the same call there.
I set the new timer to disabled by default so I can enable it on
successful port open like the FpTimer.

Once all that was done I again stepped through the application with
breakponts in both event functions and amazingly the FpTimer event now
fired! And after it was done the new timer also called its event...

In fact it now seems to work where it did not before.

So next I *removed* the newly dropped timer and its references in the
code and now the FpTimer still works. How very strange!

Concerning calling CheckSynchronize I do not really know where it can
be done...
I think you do not mean that I should put a timer on the main form and
then in its OnTimer event call CheckSynchronize?
This program is a GUI application and I do not know where one could
put a call like that.


-- 
Bo Berglund
Developer in Sweden

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to