Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Return Value from VCX
Message
From
02/04/2001 13:52:11
Larry Rix
Larry Rix & Associates, Inc.
Westminster, Colorado, United States
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Title:
Return Value from VCX
Miscellaneous
Thread ID:
00491003
Message ID:
00491003
Views:
59
I am looking for suggestions on returning a value from a VCX based form. As you already know, a VCX form instantiated with loMyObject = createobject("frm_MyForm", lnParm1, ...) cannot be told to capture a return value (as with SCX based DO FORM WITH ... TO ...).

Here are some notes regarding the issue as I currently understand it. Your feedback is appreciated.

1. One solution I see is that the Client module (the class issuing the createobject instruction) passes the Supplier form class object an object reference with a Client command method to run upon completion. Thus:

Client Method Code says:

local loMyObject
loMyObject = createobject("frm_MyForm",[THIS|THISFORM],"cmReturnMethod")

The Supplier Form Init says:

lparameters loClientObject, lcReturnMethod
THIS.cmSetClientObject(loClientObject)
THIS.cmSetReturnMethod(lcReturnMethod)

...

Later, the Supplier executes the following code as it is exiting:

local loClientObject, lcReturnMethod, luReturnValue
loClientObject = THIS.qoClientObject()
lcReturnMethod = THIS.qcReturnMethod
lcReturnValue = qcReturnValue()

evaluate("loClientObject." + lcReturnMethod + "(" + lcReturnValue + ")")

return

There are advantages and disadvantages to this method:

Advantages:

1. It provides that the Client form retains a level of genericity in that there is a generic Client Object reference with a generic return value method.

Disadvantages:

1. The return method MUST exist in the calling Client class object.

2. The return method of the Client is restricted to the character or string data type of the return value without complex data type management coding in either the Client or in the Supplier.

I know there is probably a flaw in this thinking somewhere, but I cannot see it.

Thanks in advance for you assistance.

Larry
Next
Reply
Map
View

Click here to load this message in the networking platform