Variable return to caller Form 
Author Message
 Variable return to caller Form

Hi folks,

Thanks all previous advice first.

I got a problem..., I cannot get modified variable from childForm

In the caller Form, I put
        DO FORM child.SCX WITH m.a, m.b, m.c, m.d TO m.answer

In the called Form, I put following in childForm.init
        PARAMETERS lcA, lcB, lcC, lcD

I also place a closeButton to close the childForm and in
closeButton.Valid I put
        lcA = "change content from form"
        ....

After closing the childForm, the variable m.a etc does not change.

Where is the problem?

TIA

RayLee



Sun, 27 Aug 2000 03:00:00 GMT  
 Variable return to caller Form

RayLee,

Modal forms can return a single value to the caller in the Unload() method. But to do that
you'll need to create a custom form property, let's call it muRetVal, using Form , New
Property from the menu. The parameters you send the form are only seen by the Init()
method of the form once that ends they go out of scope. So you need to copy the values to
form properties if you need them in any other method of the form objects. By time the
Unload() method runs the form's contained objects will have been destroyed so the only
thing you have left to return is a Form property which you can set in the Valid,
LostFocus, Destroy or InteractiveChange methods of a control, or bind the control to the
form property

And your Unload() might look like:

   return this.muRetVal

df    - (Microsoft FoxPro MVP) http://www.geocities.com/ResearchTriangle/9834/

Quote:

>Hi folks,

>Thanks all previous advice first.

>I got a problem..., I cannot get modified variable from childForm

>In the caller Form, I put
> DO FORM child.SCX WITH m.a, m.b, m.c, m.d TO m.answer

>In the called Form, I put following in childForm.init
> PARAMETERS lcA, lcB, lcC, lcD

>I also place a closeButton to close the childForm and in
>closeButton.Valid I put
> lcA = "change content from form"
> ....

>After closing the childForm, the variable m.a etc does not change.

>Where is the problem?

>TIA

>RayLee



Sun, 27 Aug 2000 03:00:00 GMT  
 Variable return to caller Form

Yes, I do believe I can help you with this problem.

The problem is in the order VFP operates on a form.  The opening of the
view occurs prior to the creation of the property THISFORM.itemCPostal.  A
simple solution is to set the NODATAONLOAD property of the view to .T.
Then, in the INIT method of the form, you can issue REQUERY('MYVIEW').

This should resolve your problem.

--
D.J. Bouchier
Behind the Scenes Computer Solutions



Tue, 29 Aug 2000 03:00:00 GMT  
 Variable return to caller Form

Joao,

The Dataenvironemnt is created before the form's Load and before the form's
Init is executed.  This means your form has not yet received the parameter
or set the value of the property when the view is being opened.

The solution is to set the NoDataOnLoad property of the view to .T. in the
data environment.  Then in the form's init, after you have assigned the
parameter to the form property you can;

 Requery("TheViewAlias")

to populate the view with data.

JimB

Hi,

I hope you can help me with this form problem:

1. I Have two forms.
2. Form1 calls form2 passing one parameter.
3. Form2 receive that value.
     In the Init() method i assign that value to a property that i have
created. ( itemCPostal )
4. In Form2 i have a Grid.
    That Grid is a View which require the value received by the form to run
the implicate SQL code.
    In the View i have ?thisform.itemCPostal in the Example box on the
filter tab .

But, when the second form runs and the view is executed, a window appears on
the screen  who tells to indicate one value for thisform.itemCPostal, i
don't understand why the view doesn't recognise that property.

Can you help ?



Tue, 29 Aug 2000 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Return variable to SDI form

2. Can I return multiple variables from a form?

3. return values of forms in variables

4. Return more than one variables from form ??

5. Where to return variable from modal form.

6. How to return return copyright info in form

7. Form does not talk to caller

8. pass a parameter to a caller form

9. Multiple return variables

10. Caller Id

11. procedure return value not numeric if procedure not include return command

12. VFP/Caller ID

 

 
Powered by phpBB® Forum Software