LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Time of application's inactivity

Is there any simple method to understand since how much time the user is no longer working on a specific application (clicking on controls, moving or resizing panels, using menus ...), without inserting a specific code in any control, panel, menu etc.?

Thanks.
Sergio

0 Kudos
Message 1 of 6
(3,682 Views)
I use a 1 second timer callback.   It's a sump task that takes care of a bunch housekeeping.  I increment a global seconds counter every time it's called.   In all my other UI callbacks, the first thing I do is clear the global seconds counter.   The sump task therefore always knows how long it's been since the program was used.    I start turning off equipment at various time intervals and finally log off all users if nothing has happed for 30 minutes.

It's not as automatic as you wanted, but it takes very little code to implement.

Jim
Message 2 of 6
(3,668 Views)
Thank you Jim,
unfortunately this need comes after years of developing and hundreds of callbacks.
So I still ask to everybody if there is a simple solution that does not require to modify all the callbacks.

Sergio
0 Kudos
Message 3 of 6
(3,662 Views)

Hello Sergio,

you might use the InstallMainCallback function to create a callback function that will be called by all panels, controls and menu bars. In this function, you could reset the timer.

Message 4 of 6
(3,656 Views)
Hello Sergio,

If you want to implement Jim's timer solution, you probably don't need to modify all your existing callbacks. You can install a global callback for your application using the function InstallMainCallback (make sure you disable idle events when you call it). The callback that you install with this function should receive the same events that all your individual callback functions receive. Keep in mind, however, that as of CVI 8.1, mouse move events are also sent to the callbacks. So if you don't want a mouse moving over your UI to be considered "activity," you might want to check the event id before resetting the timer.

Luis

Drats. Looks like I was beaten to the punch by Wim Smiley Surprised

Message Edited by LuisG on 08-27-2007 11:11 AM

Message 5 of 6
(3,654 Views)
Thank you All for your suggestions, they look like good ideas to solve my problem.

Sergio

0 Kudos
Message 6 of 6
(3,638 Views)