IBM®
Skip to main content
    Country/region select      Terms of use
 
 
   
     Home      Products      Services & solutions      Support & downloads      My account     

developerWorks  >  Lotus  >  Forums & community  >  Best Practice Makes Perfect

Best Practice Makes Perfect

A collaboration with Domino developers about how to do it and how to get it right in Domino

The NotesTimer class isn't needed very often, but when you do need it, there are a couple of things to watch out for.
First, bear in mind that the current NotesUIDocument or view isn't necessarily the one in which your timer is running -- the user can leave a window open and open or switch to another window, while your time keeps ticking away in the original one. Use a global variable to store the NotesUIXxx object, and assign it from the Postopen event of the design element containing the timer object. Never use NotesUIWorkspace.CurrentWhatever method unless it's to compare with the global object to see whether this window is still the current one.

By the way, just because the current UI window isn't the window containing your timer, don't assume that the timer window isn't visible to the user. In a frameset (or composite application), another frame could easily have focus but your problem report alert window (or whatever) still be visible.

Second, bad things (e.g. a crash) can happen if another timer event occurs while you haven't finished processing the previous one. Even if you think whatever you're doing is going to be pretty quick, if it involves access to a remote resource or to the UI, you should assume it's going to take a long time, and disable the timer until you exit the timer subroutine. If there's a modal dialog open, UI operations can get hung up for as long as the dialog remains open, so there's really no telling how long it'll take just to update that field value.

Andre Guirard | 7 August 2008 05:09:00 AM ET | Home, Plymouth, MN, USA | Comments (1)

Search this blog 

Disclaimer 

    About IBM Privacy Contact