Hi All

I want to change a form as a class. But I don't know how to get value
return the class as I'm usually used to get from a form with this
command

DO FORM myform TO leResult

When I create an object

SET LIBRARY TO myclass.vcx
oForm=CREATEOBJECT("myform")
oForm.show
....??

What is the next line in order to get the result returned by that class ?

Thanks A Lot

Re: Return value from a class by Jacobus

Jacobus
Wed Jun 30 23:02:09 CDT 2004

You can use something like this:

SET LIBRARY TO myclass.vcx
oForm=CREATEOBJECT("myform")
oForm.show(1) && Modal
if vartype(m.oForm.vRetVal) = "O"
vRetVal = m.oForm.vRetVal
else
&& form was closed
endif

In the OK.Click event :
thisform.vRetVal = .....
thisform.Hide()
endif


"budieko" <eko_dja@myrealboxJUSTREMOVE.com> wrote in message
news:urk1rcxXEHA.3420@TK2MSFTNGP12.phx.gbl...
> Hi All
>
> I want to change a form as a class. But I don't know how to get value
> return the class as I'm usually used to get from a form with this
> command
>
> DO FORM myform TO leResult
>
> When I create an object
>
> SET LIBRARY TO myclass.vcx
> oForm=CREATEOBJECT("myform")
> oForm.show
> ....??
>
> What is the next line in order to get the result returned by that class ?
>
> Thanks A Lot
>
>



Re: Return value from a class by budieko

budieko
Thu Jul 01 00:31:10 CDT 2004

Thanks, Jacobus

Unfortunately my OK.Click event release my form (formclass),
because it is not a problem for DO FORM command



"Jacobus Terhorst" <lanto3000@hotmail.com> wrote in message
news:esEwwAyXEHA.2844@TK2MSFTNGP12.phx.gbl...
> You can use something like this:
>
> SET LIBRARY TO myclass.vcx
> oForm=CREATEOBJECT("myform")
> oForm.show(1) && Modal
> if vartype(m.oForm.vRetVal) = "O"
> vRetVal = m.oForm.vRetVal
> else
> && form was closed
> endif
>
> In the OK.Click event :
> thisform.vRetVal = .....
> thisform.Hide()
> endif




Re: Return value from a class by christophe

christophe
Thu Jul 01 02:22:26 CDT 2004

budieko,

a not very OOP/VFP way is to use a public
variable which holds the return value and doesn't
get released when closing the form.

regards
christophe
--
\|||/
(o o)
----ooO-(_)-Ooo-------------

¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,ø¤º°`°
º


"budieko" <eko_dja@myrealboxJUSTREMOVE.com> schreef in
bericht news:urk1rcxXEHA.3420@TK2MSFTNGP12.phx.gbl...
> Hi All
>
> I want to change a form as a class. But I don't know how
to get value
> return the class as I'm usually used to get from a form
with this
> command
>
> DO FORM myform TO leResult
>
> When I create an object
>
> SET LIBRARY TO myclass.vcx
> oForm=CREATEOBJECT("myform")
> oForm.show
> ....??
>
> What is the next line in order to get the result returned
by that class ?
>
> Thanks A Lot
>
>



Re: Return value from a class by Anders

Anders
Thu Jul 01 06:37:07 CDT 2004

oForm=CreateObject('myform',parm1, parm1)
The parameter can be Thisform or some reference to the calling object that
issues DO FORM. In the called form's Init you immediately copy the parameter
to a form property. You can then use this property to commnicate with the
calling form and its properties.
-Anders

"budieko" <eko_dja@myrealboxJUSTREMOVE.com> wrote in message
news:urk1rcxXEHA.3420@TK2MSFTNGP12.phx.gbl...
> Hi All
>
> I want to change a form as a class. But I don't know how to get value
> return the class as I'm usually used to get from a form with this
> command
>
> DO FORM myform TO leResult
>
> When I create an object
>
> SET LIBRARY TO myclass.vcx
> oForm=CREATEOBJECT("myform")
> oForm.show
> ....??
>
> What is the next line in order to get the result returned by that class ?
>
> Thanks A Lot
>
>


Re: Return value from a class by Wolfgang

Wolfgang
Fri Jul 02 16:26:43 CDT 2004

Hi budieko!
local loParm as empty
loParm=create("empty")
addproperty(loParm,"cParameter1","")
addproperty(loParm,"nParameter2",0)
SET LIBRARY TO myclass.vcx
oForm=CREATEOBJECT("myform")
oForm.addproperty(oParameter,loParm)
oForm.show(1) && Modal
***************************
* After the form has terminated
* the object variable loParm holds the
* values
?loParm.cParameter1
?loParm.nParameter2

****************************************
* form class Unload Method
****************************************
thisform.oParameter.cParameter1="Bill Gates"
thisform.oParameter.nParameter2=2004
--
----------------------------------------------

Mit freundlichen Grüßen

Wolfgang Schmale

[MVP für Visual FoxPro]

--------------------------------------------
"budieko" <eko_dja@myrealboxJUSTREMOVE.com> schrieb im Newsbeitrag
news:urk1rcxXEHA.3420@TK2MSFTNGP12.phx.gbl...
> Hi All
>
> I want to change a form as a class. But I don't know how to get value
> return the class as I'm usually used to get from a form with this
> command
>
> DO FORM myform TO leResult
>
> When I create an object
>
> SET LIBRARY TO myclass.vcx
> oForm=CREATEOBJECT("myform")
> oForm.show
> ....??
>
> What is the next line in order to get the result returned by that class ?
>
> Thanks A Lot
>
>