Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Is it possible to return a value from a class?
Message
De
16/02/2001 16:05:39
Bob Lucas
The WordWare Agency
Alberta, Canada
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00476794
Message ID:
00476814
Vues:
21
I have a very simple parameter class that I use with forms, mostly because I often want more than one variable returned. The parameter class has one property, an array and the the init method redimensions the array.

I create it like this:

ox = CreateObject("cParams", 4)
which means I now have in ox
ox.parms[1]
ox.parms[2] etc.

I then call forms with:
DO myform with ox

In the init of myform:

LPARAMETER toParms

*-- in order to keep a reference to toParms available:

thisform.oparms = toParms

In the code, I will populate thisform.toParms.parms[1] - [4] as necessary

Then in the destroy:

thisform.toParms = NULL

*-- this removes the reference to the object so the form can properly close.
*-- but since ox still exists in the calling method and since thisform.toParms
*-- was just a reference to ox, ox now has the values from the form.

That's it!





>I know you can do something like
>do form to myvariable
>
>Is there a similar way to get a variable from the object as it is released?
>
>obj=createobject("objtomake")
> then when the object is released some variable is set.
>i.e.
>in the release event
>return obj.RetVal would place the value of obj.retval someplace
>
>TIA,
>Mike
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform