Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Save name of the calling form
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00622735
Message ID:
00622806
Vues:
29
Hi Roi,

Just curious, why did you repeat this code twice: in black and in blue? :))

Thanks for sharing, sounds like a great way, but we don't have it implemented this way here, so we're still using multiple parameters in our forms...

>>How do you pass calling object to the child forms? Can you show some code?
>
>Sure, I have a DoForm method in the form that handles it all for me.
>
> In the base form class I have:
>Properties:
>
.oParam
>.ParentForm
>
>Methods:
>
** Form.Init
>lparameters toParam
>If Vartype(toParam) = "O" And Not Isnull(toParam)
>	.oParam = toParam
>	.Parentform = toParam.Parentform
>EndIf
>
>
>
>
** Form.DoForm
>Lparameters tcFormName, tcParameter
>
>**-----------------------------------------------------------------------
>** Add the parent form to the parameter, or make a new one if it doesn't
>** exist
>**-----------------------------------------------------------------------
>Local oParam
>If pcount() > 1
>	** Add thisform to the parameter
>	oParam = tcParameter
>	oParam.ParentForm = This
>Else
>	oParam = Newobject('parObject', 'fk_framework')
>	oParam.ParentForm = This
>Endif
>
>If Type("GoApp.Name") = "C"
>	** When the app is up and running
>	GoApp.DoForm(tcFormName, oParam, tlNoMultipleInstances)
>Else
>	** When we are just running the form from the IDE
>	FormToCall = "forms/" + tcFormName
>	Do Form (FormToCall) With (tcParameter)
>endif
>
>
>Now when I need to run a new form from a existing form I just use the .doForm method.
>
>
thisform.doForm("someChildFormsName")
>
>If I want to send some parameters along to the form I just create a parameter object, add any needed paramaters to it, and send that as well. The base form class automagically adds itself to the parameter object, or creates it and calls the new form.
>
>Now any time I want to access the .ParentForm, say to tell it to refresh or something, it's right there. All the parameters passed are held in the thisform.oParam property.
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform