Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Working with 2 forms..
Message
De
29/04/2009 03:11:14
 
 
À
28/04/2009 23:46:42
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Versions des environnements
Visual FoxPro:
VFP 9 SP2
Divers
Thread ID:
01396857
Message ID:
01396869
Vues:
87
>I have two forms, form1 and form2 show at the same time with form2 as the active form..
>
>I want to set caption to a button in form1 when form2 is active..
>
>How do I do this?
>

You'll need an object reference. The way how to get it might depend on how the two are related -
One option: By default, Vfp keeps track of running forms in _screen.Forms, so you can loop thru it:
LOCAL loForm as Form
FOR EACH loForm IN _screen.Forms
	? loForm.Name
ENDFOR
Inside the loop, you can check if m.loForm is the desired one, perhaps by comparing the loForm.Name if it is unique.
Or use PemStatus() to see whether it has a certain custom method that you created in the Form Designer, e.g. "SetCaption()" or so.


Or another option: you can pass object references directly, instead of scanning _screen.Forms: say form1 runs form2 in a button.Click(). In that case you can do something like:
* form1.someButton.Click():
Do Form form2.SCX With Thisform
.... and in form2.Init() receive the parameter:
LParameters toCallingForm
Thisform.oForm1 = m.toCallingForm && you added that custom property in the Form Designer
Now you can use the "Thisform.oForm1" reference in any method of form2 or its members.



hth
-Stefan
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform