Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
_Tally and timers
Message
De
09/03/2006 11:53:58
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
09/03/2006 08:13:38
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
01102133
Message ID:
01102797
Vues:
23
>>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
>
>I have done your test and it suggests that my *old* understanding is the correct one and Fabio's understanding is wrong! Agree?

IMHO Fabio's is right.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform