Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
_screen and forms
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00112065
Message ID:
00112092
Views:
24
Mike,

I'll disagree with Ed's suggestion a little. I personally think it's better to pass an object reference from the first form to the second instead of using a public global object.

Just pass thisform to the child form, and store it in a a property of the child form in it's Init. It encapsulates the communication and makes the child form more reuseable.

This requires the child form to have "inherent" knowledge about the parent form though, i.e. the parameter names or contained object names that you are going to manipulate in the child form.

Another way of doing this is to create an "interface" object to handle the inter-form communication. There is an example of this on my website.

The reason that this works from the command window is because VFP is creating public scoped memvars that your code is using. Within a prg it's not the same.

>Has anybody run into this, I'm starting a form from some code that is part of another form, the 2nd form gets some user input & does some processing then stores some data back into properties in the original form.
>
>At design time code in Form2 can refer to Form1 by name:
>
>i.e.
>
> isp_form.current_id = thisform.edit1.value
>
>but at run time the only way I can get it to work is:
>
> form_index=_screen.formcount
> For i = 1 To from_index
> If _screen.forms(i).name = "isp_form"
> f1_index = i
> Exit
> EndIf
> EndFor
> If f1_index
> _screen.forms(f1_index).current_id = Thisfrom.edit1.value
> EndIF
>
>The above code seems to work well but, I was just wondering why I can't call the from directly at run time?
>
>Thanks,
>
>Mike
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Previous
Reply
Map
View

Click here to load this message in the networking platform