Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Forms returning values
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00323129
Message ID:
00323148
Views:
24
Just a note:
Remember that the object is passed by reference, so any changes to it's properties will still exist, regardless of what is actually returned by the form. You can also do this same thing with arrays.
Mark

>>When we issue "do form myform to " the form called returns only one value to . Is there a way to receive more then one value.
>
>You can create an object and pass that to the form. Here is an example from Fred Taylor in 1999
>
>*********************
>Define your object programmatically.
>
>DEFINE CLASS parameterobject AS custom
>MyNumVal = 0
>MyCharVal = ''
>MyArray[5] = .f.
>ENDDEFINE
>
>*
>* Populate the parameter object's properties
>*
>oParam = CREATEOBJECT('parameterobject')
>oParam.MyNumVal = 5
>oParam.MyCharVal = 'Test string'
>oParam.MyArray[2] = DATE()
>oParam.MyArray[5] = 'samples'
>*
>* Now call your form with the object
>*
>DO MyForm WITH oParam
>
>MyForm:Init
>LPARAMETER tobject
>thisform.PObject = tobject
>
>Other methods:
>thisform.Pobject.MyNumVal = 100
>etc...
>
>
>Your form's init event declares it is receiving the parameter and updates the values as needed. These updates can take place anywhere in your form if your form has a property to store the reference. Now, when you get back from your form, the parameter object has the updated values and you can do whatever you need to with them. Kind of like global variables, only better!
>*********************************
"It hit an iceberg and it sank. Get over it."
Robert Ballard, dicoverer of the Titanic wreckage.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform