Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Form Management Problem Again
Message
From
30/09/1999 03:54:37
Mark Hall
Independent Developer & Voip Specialist
Keston, Kent, United Kingdom
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00270872
Message ID:
00270913
Views:
28
>Help?!
>
>I have a main form that does this in the init method:
>
> do form custopen name custopen noshow
> do form custclose name custclose noshow
>
>The forms open correctly and do not show in my environment. Then in the click method of a button on the main form I have:
>
> custopen.visible = .t.
>
>And I get an error that object custopen cannot be found. However, I can choose the form 'custopen' from the menu bar, and when I do the dugger shows wontop() as 'custopen'.
>
>In the form designer, the caption is custopen and the name is custopen. The form is built from a class prj2custclass, does that matter?

The variables CustOpen and CustClose will be scoped to the Init method of your main form. These variables will not exist at the global application level. If you try
do form custopen name custopen noshow LINKED

you will see that the forms get destroyed as soon as the variables go out of scope.

The quick and dirty fix is to declare the form variables PUBLIC
PUBLIC CustOpen, CustClose
although this isn't the best solution.

You might allocate the sub-forms to properties of your main screen ( I assume that this is possible).
do form custopen name loMainForm.CustOpen noshow LINKED

Another possibility would be to channel all form create/destroy/show through a Form Manager object that will manage form references internally.
Regards
Mark

Microsoft VFP MCP
Menulib - OO Menus for VFP www.hidb.com/menulib
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform