Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Add en event to the queue instead of processing immediat
Message
De
08/10/2013 09:17:47
 
 
À
07/10/2013 12:08:09
Mike Yearwood
Toronto, Ontario, Canada
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 8
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01584803
Message ID:
01585049
Vues:
84
>I think you can RELEASE (m.lcVarName) and I'm pretty sure you can do PUBLIC (m.lcVarName) too. Side effect of avoiding & as much as possible.
>
>>>>I know there are other solutions to this problem, but there have been so many times when I want to have better control over event processing, so my question is how can I programmatically trigger an event to be processed in the event loop instead of immediately?
>>>
>>>Among simple tricks is to have an inactive timer which you will activate, have it do what you want after some milliseconds and deactivate again.
>>
>>Drew Speedie described something he called a "hand_grendade" which did just that.
>>
>>Here's our code (sorry about the dependencies, but they're easy enough to figure out):
>>
>>
>>LPARAMETERS tcCommand, tnDelay, toThis, toThisform
>>LOCAL lcThisVarname, lcThisFormVarname, loTimer
>>
>>tnDelay = Param_Val(tnDelay,200)
>>lcScript = tcCommand
>>lcCRLF = CHR(13)+CHR(10)
>>
>>IF VARTYPE(toThis) = "O"
>>	lcThisVarname = "hg_" + SYS(2015)
>>	RELEASE &lcThisVarname
>>	PUBLIC &lcThisVarname
>>	STORE toThis TO (lcThisVarname)
>>	lcScript = STRTRAN(lcScript,"this.",lcThisVarname + ".",1,-1,1)
>>	lcScript = lcScript + lcCRLF + "RELEASE " + lcThisVarname
>>ENDIF
>>
>>IF VARTYPE(toThisform) = "O"
>>	lcThisFormVarname = "hg_" + SYS(2015)
>>	RELEASE &lcThisFormVarname
>>	PUBLIC &lcThisFormVarname
>>	STORE toThisform TO (lcThisFormVarname)
>>	lcScript = STRTRAN(lcScript,"thisform.",lcThisFormVarname + ".",1,-1,1)
>>	lcScript = lcScript + lcCRLF + "RELEASE " + lcThisFormVarname
>>ENDIF
>>
>>lcScript = "lparameters toTimer" + lcCRLF + lcScript
>>
>>_SCREEN.oapp.addproperty("oHGTimer",NEWOBJECT("timer_adhoc","proctrls.vcx","",lcScript,tnDelay,.T.,.T.,.T.))
>>
True. It doesn't run thousands of times, though, being run in UI situations where something has to be delayed.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform