Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Return values through parameter references
Message
From
08/08/2008 23:13:16
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Vista
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01337702
Message ID:
01337732
Views:
17
You can pass values to the form via the INIT as parameters and then save to a property. What I do is the following:

In the method/procedure that will call the form:
loMethod = CREATEOBJECT("Empty")
ADDPROPERTY(loMethod,"StringVal","")
ADDPROPERTY(loMethod,"IntVal",0)
llReturnOK = .F.
DO FORM MyForm WITH loMethod TO llReturnOK
IF llReturnOK
     ** Process the return values in the loMethod object properties
ENDIF
Then in the INIT method of the form (I define a custom property "oReturn" in the form):
LPARAMETERS poReturn
thisform.oReturn = poReturn
...
Now the called form can store values in the object:
thisform.oReturn.StringVal = "Return string"
thisform.oReturn.IntVal = 9
I still use the RETURN in the UNLOAD event to return whether the user entered data or cancelled:
RETURN thisform.UserEntry
I create UserEntry as a custom property and initialize to .F. -- then in the "Save" click event method, I set the values as appropriate and save .T. to thisform.UserEntry. This gives the calling program notification of user entered data or whether they cancelled.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform