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
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement