Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Returning an array from a form
Message
 
À
14/04/2005 13:33:29
Richard Meltzer
Great Lakes Behavioral Research Institut
Cranberry Township, Pennsylvanie, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 7
Database:
Visual FoxPro
Divers
Thread ID:
01004788
Message ID:
01004813
Vues:
24
Another approach I have used allows passing 1 parameter (an object), and you can return anything you want... even if multiple values...
*/ Create an object base on a line control 
*/ could be anything, even a custom class of your own
oMyParm = createobject( "line" )
with oMyParm
   .AddProperty( "MyArray[1,1]")
   .AddProperty( "My2ndArray[1,1]" )
   dimension .MyArray[ 5, 3 ] && or whatever dimensions...
   dimension .My2ndArray[ 2,4]  && or whatever

   .AddProperty( "nSomeNumber" )
   .nSomeNumber = 123

   .AddProperty( "dSomeDate" )
   .dSomeDate = ctod( "4/14/2005" )

   .AddProperty( "nReturnStatus" )
   .nReturnStatus = 0

endwith
Then, you can call your form with one parameter...
do form YourForm with oMyParm
In the INIT of the form, you can store this object reference in the form and have it available for the entire duration of the form, set values upon return and everything can get passed back...
*/ In the INIT() of the form
lparameters oYourParmObject

Thisform.AddPropery( "oHoldObject" )
Thisform.oHoldObject = oYourParmObject
*/ In the UNLOAD event, put whatever you want back in 
*/ the object but be sure to release the object pointer
*/ as held in the form when done or the form wont release
WITH Thisform.oHoldProperty

   dimension .MyArray[ 1, 2] && or whatever the result would be...
   dimension .My2ndArray[ 3,3]  && or whatever redefinition you need
   .nSomeNumber = 456
   .dSomeDate = date() + 20  && or anything from the form...


   .nReturnStatus = 1  && or whatever status codes you may want
ENDWITH

*/ Clear before release
Thisform.oHoldProperty = NULL
Then, after the form is done, you can check ANY of the properties, statuses, array changes, etc you need...
*/ After your "do form YourForm with oMyParm" near the top...
if oMyParm.nReturnStatus = 1
 ...
 ...

if oMyParm.MyArray...
...
...
Hope this opens the door to some extensive parameter passing to/from for you.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform