Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Timer snippet
Message
 
À
11/10/2012 15:32:02
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
01554837
Message ID:
01554841
Vues:
44
>Could someone please post a little snippet for using the timer in VFP
>
>I want the timer to run for a periood of time and
>when the time is up, DO a code.prg
>
>Sounds simple, but I have not found any example code in VFP help.
>
>Thanks kids.


Some simple code:
loForm			= CreateObject('myForm')
loForm.Show(1)

define class myForm as Form
	add object myTimer as Timer with Interval = 1000
	
	add object myLabel as Label with Caption = 'Firing timer', Visible = .f.
	
	procedure myTimer.Timer
		this.Enabled = .f.
		thisform.myLabel.Visible = .t.
		thisform.DoSomething()
		thisform.myLabel.Visible = .f.
		this.Enabled = .t.
	endproc
	
	procedure DoSomething()
		Inkey(1) && Just delaying...
	endproc
enddefine
"The five senses obstruct or deform the apprehension of reality."
Jorge L. Borges?

"Premature optimization is the root of all evil in programming."
Donald Knuth, repeating C. A. R. Hoare

"To die for a religion is easier than to live it absolutely"
Jorge L. Borges
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform