LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Hold mouse left key inhibit periodic timer

Hi,
 
I have a periodic timer to write data every seconde on a log file using a periodic timer.  If I hold down mouse keys over the title bar of my application, the program seems to freeze and the log is not written anymore.  Everything return to normal as soon as I release the mouse button. 
 
Is this behavior normal ??
 
CVI 8.0 / XP
 
Regards
0 Kudos
Message 1 of 2
(3,440 Views)
Yes, this is normal behaviour: holding mouse button while n a top level window blocks timer scheduling (this is called "event-blocking condition"). There are a couple of user events that can cause this to happen and as far as I know the only solution is to use an asyncronous timer (<cvidir>\toolslib\toolbox\asynctmr.fp) instead of a regular timer. More informations about event-blocking conditions can be found in the online help for ATTR_ALLOW_UNSAFE_TIMER_EVENTS in SetSystemAttribute function.
Using an async timer is quite easy: its callback has the same format as standard UI timers callback, with the only difference that the first parameter is not the panel handle (since the timer is executed in a separate thread outside the UI one): in case you are using panelhandle received as a parameter you will need to use a different method to get this value (for example callbackData parameter of the function). Also, considering it executes in a different thread, standard multithreading cautions must be taken while handling variables that are used also in different threads in the program.


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 2 of 2
(3,437 Views)