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)


1) NotesTimer tips
Gabriel Amorim | 8/7/2008 10:18:14 AM

I confess I threw in trash all the work I mentioned I was doing to improve that class. Those recent tips sounded indeed very good and better than I was planning.

I'll try them a little more and then I should post some feedback.

 Add a Comment
Comment:  (No HTML - Links will be converted if prefixed http://)
Remember Me?     Cancel

Search this blog 


    About IBM Privacy Contact