Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Referencing THISFORM from a .PRG file
Message
De
11/02/2000 18:42:52
 
 
À
11/02/2000 18:23:40
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00331088
Message ID:
00331180
Vues:
20
>>Best would be to pass an object reference to the call:
>>
>>*...in method code
>>abcd=MyProcUDF(thisform,...other parms)
>>*
>>*
>>FUNCTION MyProcUDF
>>LPARAMETER toFormRef, ...yadda, yadda, yadda
>>IF toFormRef.OfferCredit
>
>That's the way I ended up doing it. Works great!

You need to take some care here, especially if you invoke methods of the object you've passed into your procedure. It's possible that invoking a method of the object might invoke another instance of the same function; at a minimum, I'd aggressively make sure that I used an LPARAMETERS statement to force LOCAL scoping of the parameters, and I'd explicitly declare all variables as LOCAL to avoid possible side-effects where VFP creates an undeclared variable with a PRIVATE scope the first time, but uses the existing visible PRIVATE instance on subsequent calls.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform