Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How do you return data from a modal Form object?
Message
From
18/03/1998 23:32:20
 
 
To
17/03/1998 14:06:48
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00085149
Message ID:
00085551
Views:
44
Using createobject("someformclass") is fine. Just don't destroy the form upon exit, but rather, set it's visible state to false. That way, you return to your calling program while keeping all the references of the newly created form available.
Let's say, for instance, the form in your vcx simply contains one text box, an Ok button and a Cancel button. Make sure you add an IsCanceled property to that class. Then use the following code:
LOCAL oFormInst
oFormInst = CreateObject("clFormClass")
oFormInst.Visible=.T.
*!* No code gets executed until the form is hidden.
*!* The Ok button in your class takes care of that, by setting the form's
*!* visible property to False.  The Cancel button also does that, but it
*!* first sets the IsCanceled Property to True
*!* Then, to read your return values:
IF !oFormInst.IsCanceled
   DO CASE
      CASE oFormInst.Text1.Value = "Some Text"
         *!* Process results here
      CASE ...
   ENDCASE
ENDIF
You can either release oFormInst manually, or wait until it falls out of scope and releases itself.

Hope this helps.
Previous
Reply
Map
View

Click here to load this message in the networking platform