Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Referencing THISFORM from a .PRG file
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00331088
Message ID:
00331106
Views:
20
>>>>I have a function "ConvMacros" in my procedure library. This function used to be a form method, but now I need to use it from multiple forms so I've moved it into my ProcLib.prg file.
>>>>
>>>>How can I reference a property of the active form?
>>>>
>>>>I.E.
>>>>
>>>>
>>>>IF THISFORM.OfferCredit
>>>>  * do something
>>>>ELSE
>>>>  * do something else
>>>>ENDIF
>>>>
>>>>
>>>>TIA
>>>
>>>Try _SCREEN.ActiveForm (this can, however, cause problems if certain ActiveX controls are present), or _SCREEN.Forms(1). Personally, I'd rather pass the form as a parameter to the code and do manipulations via the parameter. That way, if the ActiveX problems are solved or what happens to the order of the forms collection when one is brought to the top changes, you're safe.
>>
>>So I'd call the function like this
>>
>>cText = ConvMacros( cTextToConvert, THISFORM )
>>
>>Then ConvMacros would look like:
>>
>>
>>
>>FUCTION ConvMacros
>>LPARAMETERS cTextToConvert, oForm
>>
>>IF oForm.OfferCredit
>>  * do something
>>ELSE
>>  * do something else
>>ENDIF
>>

>>
>>Sorry, but passing a form as a parameter is kinda new to me :) Is this close ???
>>
>You got it, Larry.< s >

Great, Thanks!
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform