>>I have several forms in an app. If there is no user interaction for 30 minutes I'd like to shut VFP6 down. Is there a way to do this without hardcoding a timer in each form that gets reset by control's interactive change, etc.?
>>
>>Thanks,
>>Allen
>
>I think you would need to something like this:
>
>
Still use a timer.
>Set ThisForm.KeyPreview = .T. for each form (do this in your base class).
>In the Form.KeyPress event, issue Timer.Reset(). This will start counting from zero. (Do this in your base classes, too.)
Just to add to your suggestion, I wouldn't necessarily reset the timer unless you create a timer only for this purpose. I use one timer throughout my application and it broadcasts messages through the various manager classes that it fired. Objects that receive the message know what they need to do if the timer occurs. All timed events are configured to occur on multiples of the timer interval.
Ex.
Timer interval = 6 seconds (1/10th minute)
Event 1 needs to occur every minute - MOD(TimesTimerEventFired,10) = 0
Event needs to occur every 10 minutes - MOD(TimesTimerEventFired,100) = 0
etc.
Using one timer for everything prevents timer events from stepping on each other toes. It also makes debugging easier in that you only need to shut down one timer (if necessary).
Just my $0.02.
Larry Miller
MCSD
LWMiller3@verizon.netAccumulate learning by study, understand what you learn by questioning. -- Mingjiao