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

Larry, looks like the others got your problem solved, but I wanted to throw in another couple of ways to handle this. Firstly, if a procedure needs to reference things in a containership hierarchy, then it probably deserves to live in a class that can be added to the form. Then you can

THISFORM.AddObject("oCredit","MyCreditClass")

and then the class, as a member of the form, can reference the PEMs of the form with THIS.Parent.Whatever.

This would be my preferred method. But another way still, and perhaps a little simpler than passing the form as a parameter:

oTHIS = THISFORM
RunProc()

than the RunProc procedure can just reference oTHIS because its private variable.
Erik Moore
Clientelligence
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform