Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Referencing THISFORM from a .PRG file
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00331088
Message ID:
00331099
Vues:
19
>>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 ???

Thanks
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform