Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
_Tally and timers
Message
From
08/03/2006 14:23:41
 
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
01102133
Message ID:
01102575
Views:
21
Hi,

>This *was* my understanding about timers: A timer does not fire during a SELECT-SQL and a next line that tests for the _TALLY. It only fires on moments that an input (most notably from a user) is possible.
>
>As a consequence of that understanding, there is *no* need to save/restore _TALLY in the timer event's code.
>
>This is about to become my understanding about timers: If _vfp.autoyield=.T. a timer can also fire after a SELECT-SQL and before the next line that tests for the _TALLY.
>
>As a consequence of that understanding, there *is* a need to save/restore _TALLY in the timer event's code.
>
>I'm now searching affirmation of my new understanding here.

Well here's a crude test:
DEFINE CLASS form1 AS form


	Top = 0
	Left = 0
	DoCreate = .T.
	Caption = "Form1"
	Name = "Form1"


	ADD OBJECT timer1 AS timer WITH ;
		Top = 24, ;
		Left = 36, ;
		Height = 37, ;
		Width = 61, ;
		Name = "Timer1"


	ADD OBJECT command1 AS commandbutton WITH ;
		Top = 36, ;
		Left = 204, ;
		Height = 37, ;
		Width = 73, ;
		Caption = "Command1", ;
		Name = "Command1"


	PROCEDURE timer1.Timer
		this.Enabled = .F.
		SELECT id FROM Table1 WHERE id <> 1 INTO CURSOR j
                * _tally: 50
		this.Enabled = .T.
	ENDPROC


	PROCEDURE command1.Click
		Application.AutoYield = .T.
		thisform.timer1.Interval = 100
		thisform.timer1.Enabled = .T.
		FOR x = 1 TO 100000
		  SELECT id FROM Table1 WHERE id = 1 INTO CURSOR viv
                  * _tally: 1
		  DOEVENTS   && No problem if this is not here
		  IF _tally <> 1
		    SET STEP ON 
		  ENDIF
		ENDFOR
		=MESSAGEBOX("Done")
	ENDPROC
	
ENDDEFINE
Only fails if the 'DOEVENTS' is immediately after the 'SELECT' and AutoYield's true. Doesn't ness. prove anything tho....
Regards,
Viv
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform