Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Referencing THISFORM from a .PRG file
Message
From
11/02/2000 18:42:52
 
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00331088
Message ID:
00331180
Views:
21
>>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform