Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Referencing modeless forms.
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00292565
Message ID:
00293231
Views:
25
>>This won't work if myForm is modeless. Let's say the code: DO FORM myForm NAME oMyForm is in the click event of a command button. The variable oMyForm is scoped to the click event. Because the form is modeless, the click event finishes and the variable is no longer accessible. Here is an example:
>>create 2 modeless forms, form1 has a command button with the following code: DO FORM form2 NAME oForm2 LINKED. When you run form1 and click on the button, form2 will come up and immediately close, because the variable oForm2 goes out of scope almost immediately. If form2 is made modal, then the code stops executing in the click event leaving the variable in scope, and therefore accessible.
>
>Of course, modals are fine for certain situations. But for modeless, just don't use LINKED and it should work fine. I've found LINKED of little actual value. But if you need it, then a way to conquer your problem is to create a form property (or an array if many forms):
>
>1) Add Parent form property, say oMyForm.
>2) Launch child form like this:
>
>DO FORM myForm NAME thisform.oMyForm LINKED

Thanks Bruce,

I agree with you about LINKED. I just used the linked example to illustrate that the variable oMyForm goes out of scope. The same is true without using linked. The form wouldn't close right away, but you would NOT be able to reference it with oMyForm. I think it's easiest to just make the variables public, but an array might be interesting. Thanks again for your help.

Thanks,
Marcus.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform