Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Returning a value
Message
From
30/01/1999 11:07:59
 
 
To
30/01/1999 10:26:04
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00182149
Message ID:
00182155
Views:
12
Hi Dan,

>How do I return a value from a visual class. I have created a class based on a form. The form is Modal. In the Unload event of the form I placed return This.cRetVal.
>
>In the calling program, I have:
>
>oObject = createobject("MyObject")
>cRetVal = oObject.Show()
>
>cRetVal is always .F. when returning.
>
>What am I doing wrong?

You cannot return a value from .vcx based modal forms(without a little trick). The Form.Unload is ignored for .vcx based forms.

You can create a wrapper program that declares a private memvar and then calls the form. The memvar is available to the form and can be set in the Unload event.

Make a wrapper program;
procedure wrapper
lparameter myobject
private tuReturnValue
tuReturnValue = .null.
oObject = createobject("MyObject")
oObject.Show(1)
return tuReturnValue

In the Unload of the modal form do this;
tuReturnValue = This.cRetVal

Then you would issue something like this;

x = wrapper("myobject")

hth,
Kendall Webb
Senior Software Engineer
MCAD.Net/MCSD.Net
Previous
Reply
Map
View

Click here to load this message in the networking platform