Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Turning off a timer control
Message
De
14/04/2011 08:20:40
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01507105
Message ID:
01507287
Vues:
185
>That's what I thought.
>
>Mmmmmm....
>
>Looks like a have a bug in my code then, it seems to be still firing.
>
>Thanks guys, will look deeper

In one app, I've found that I need code like the following in the Timer method to ensure that the timer fires only once:
	IF NOT This.Enabled
		* This might happen if the timer fired twice before we disabled it.
		This.oDLmainRef.AddToLogFile("Timer is disabled, getting out of timer method.")
		RETURN
	ELSE 
		THIS.ENABLED = .F.
		LOCAL nTimerInterval
		nTimerInterval = This.Interval
		This.Interval = 0
		This.oDLmainRef.AddToLogFile("In Timer event of response timer")
	ENDIF 
The key point is that just inside the method, I check whether it's already disabled and get out if it is. Adding this code solved some ugly problems for me, and I do now and them see the "Timer is disable" line in the log I'm creating. (This is a COM object, so the log is critical.)

Tamar
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform