Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Referencing THISFORM from a .PRG file
Message
De
11/02/2000 18:48:45
 
 
À
11/02/2000 18:42:52
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00331088
Message ID:
00331184
Vues:
18
>>>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.

Thanks for the heads-up Ed, I'll take that advice. Although, at this time, I'm only referencing properties of the form... who knows what the future holds ;)
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform