Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Controlling another form from current form
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00284853
Message ID:
00285808
Vues:
17
>How about:
>
>THIS.oForm.Release() && releases the form 'cls_timerform'
>THIS.oForm = .NULL && clears the object reference to the form
>
>HTH,
>Evan Pauley
>
>>Works great as property, but now how do I release this.oform from another form.
>>
>>For example I have a FormA and a FormB
>>
>>&&FormA.init
>>this.oform = createobject('cls_timerform')
>>thisform.FormA.visible = .f. && I am hiding this form
>>
>>
>>I want know how I can access oform properties from FormB?
>>
>>Thanks
>>Nick Patel

Simple. Pass a reference to your FormA to FormB. I guess you're starting FormB from FormA. So in preparation for this, have a property on FormB call it oCallingForm. In FormB's Init method, accept a parameter and store the calling objects reference.

FormB Init:

LPARAMETER toCallingForm
this.oCallingForm = toCallingForm && save the calling forms object reference.

FormB Destroy:
this.oCallingForm = .NULL. && Gid rid of the reference or you will not be able close FormB!


Now, in FormA where you need to call FormB, do:

DO FORM FormA WITH this

From anywhere in FormB's method code that needs to reference FormA, you would do it like:

this.oCallingForm.PropertyOfFormA = somevalue
or
LocalVariable = this.oCallingForm.ProprertyOfFormA

You could also use "thisform" instead of "this"

Hope that helps!
Fred
Microsoft Visual FoxPro MVP

foxcentral.net
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform