Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to run a form saved as a class
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00400258
Message ID:
00400380
Vues:
17
Ed,
Thanks for you very informative reply re Forms as classes.

Regards,
Gerard




>>I normally run forms as : Do Form Myform with Param1,Param2,Param3
>>
>>I am starting to save Forms as classes and now am trying to run a form, but Do Form MyFormClass does not work.
>>
>>Can I still pass parameters to the form if using it as a class ?
>>
>
>You instance your Form saved as a class by using CREATEOBJ() or NEWOBJECT(); parameters would follow the declaration of required arguments to the function at the time you create the object, and the arguments are passed to the Init of the Form class in the same way as they are in DO FORM. If your Form Class MyFormClass is saved in the class library MyClass.VCX:
>
>SET CLASSLIB TO MyClass.VCX ADDITIVE
>MyFormInstance = CREATEOBJ('MyFormClass',Param1, Param2,Param3)
>MyFormInstance.Show()
>*you need a READ EVENTS to provide a wait state.
>
>The variable MyFormInstance would have PRIVATE scoping if not declared explicitly otherwise; if you need to reference it above the level where it's created, you can save the object reference to a member property of an object that will persist for as long as you need it, use the Forms collection of _SCREEN to obtain an object reference as needed, create the variable MyFormInstance as PRIVATE ahead of time in a higher-level procedure or function, or make it a PUBLIC variable (the worst of the alternatives IMO, but it's your headache, not mine...)
>
>Note: you can't use a Form class to return a value at termination the same way that you can using DO FORM ... TO with modal forms; there are other approaches available, and they've been discussed to death in the past two weeks.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform