|
The one thing you have to realize with event driven Kixscript is that a script can only be doing one thing at a time. A Kixscript has a single thread of execution. When your script is idling in the DoEvents and you have a Timer running, the event code will be executed and the clock will be updated. However, if you call a function, the timer events generated in the meanwhile go unhandled until the function returns to the main loop.
In fact, if timer events go unhandled, they are purposefully thrown into the perverbial bit-bucket to stop them from building up in the message queue. Timer "buildup" if you like. This is expected normal behavior in Kixforms and in single threaded scripts.
The solution to this, is if your calling a function that takes more than a few seconds to run, or if the function has a while or do loop in it, is to place this statement ...
$= Execute($Form.DoEvents(1))
... inside the function call, maybe somewhere in the middle or inside the loop. This is what is called an "asynchronous DoEvents" and it gives the script a chance to execute any pending events (Timers or Clicks), and the clock will be updated in a multi-threaded like fashion (but just by appearance only). Where the DoEvents goes depends on the nature of the function.
-Shawn [ 01. October 2003, 14:58: Message edited by: Shawn ]
|