Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Understanding Timers Part Duex
Message
De
13/08/2004 17:56:55
 
 
À
13/08/2004 05:18:33
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00932987
Message ID:
00933253
Vues:
27
This took me quite a while to reproduce but it did give me a clearer idea of the problem was. You'll need to make a simple HelloForm which is a modal form with one command button. In the click event just relese the form.

Here is the code:
#DEFINE APPEND				1
#DEFINE CRLF				CHR(13) + CHR(10)
DECLARE Sleep IN WIN32API INTEGER nMilliseconds


_Screen.AddObject( "EscapeButton", "EscBtn" )
_Screen.EscapeButton.Visible = .T.

** Init the file.
SET SAFETY OFF
STRTOFILE( "", "LogTimerEvents.txt" )
SET SAFETY ON

LogProcess( "Create Message Timer" )
loTestEvents = CREATEOBJECT( "TestEvents" )

READ EVENTS


DEFINE CLASS TestEvents As Custom


	FUNCTION Init
		This.AddObject( "MessageTimer", "Timer" )
		BINDEVENT( This.MessageTimer, "Timer", This, "ProcessMessages" )
		
		LogProcess( "Set Interval to 1" )
		This.MessageTimer.Interval = 1
		LogProcess( "Enable Timer" )
		This.MessageTimer.Enabled = .T.
	ENDFUNC
	
	FUNCTION ProcessMessages
		LogProcess( "Disable Timer" )
		This.MessageTimer.Enabled = .F.
		
		FOR lnOuterLoop = 1 TO 10
			LogProcess( "In for loop lnCount = " + TRANSFORM( lnOuterLoop ) )
			DO FORM HelloForm
		ENDFOR
		
		LogProcess( "Reset Timer" )		
		This.MessageTimer.Reset()
	ENDFUNC
	
ENDDEFINE


Procedure LogProcess( tcMessage )
	tcMessage = tcMessage + " " + TRANSFORM( DATETIME() ) + " " + CRLF
	STRTOFILE( tcMessage, "LogTimerEvents.txt", APPEND )
ENDPROC


DEFINE Class EscBtn As CommandButton
	Caption = "Escape"
	
	FUNCTION Click()
		CLEAR EVENTS
	ENDFUNC
ENDDEFINE
>> snip >>

>* Has the Timer been disabled : this is not necessary for me
>Disable Timer
>....
>timer.Reset


I can't reproduce this if I'm using the Timer's Timer event directly. It only occurs when I use the BindEvents. As least that's what I've found out so far.

The timer.Reset here didn't seem to help.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform