Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Form object not released
Message
 
To
07/05/1997 21:57:08
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00031077
Message ID:
00031296
Views:
51
>>The application object LoadForm() is now using PUBLIC (tcName) to make the object public before doing DO FORM X NAME (tcName). By putting PRIVATE instead of PUBLIC, the form appear and disappear right away and that's perfectly normal because once the DO FORM is finished, the LoadForm() will go away and so does the variable defined at that level.

Michel,

In my framework I also use the application object to launch a form, the method is LaunchForm(). I use a LOCAL vairable, but I also have a property of the application named oForm that is an object reference to the current form.

I launch the form with;

LOCAL loForm
DO FORM Whatever WITH THIS NAME loForm

There is more going on becuase I am using a array property to store all the forms that are open, but this is how I trck the current form.

In the fomr class it receives the reference to the applciation in its Init;

LPARAMETERS poCreator
THISFORM.Creator = poCreator

Creator is a custom property of the form class. In the form's Activate it calls;

THISFORM.Creator.Register(THISFORM, THISFORM.Name)

The register method of the application make the form the current form by;

LPARAMETERS poForm, pcFormName
THIS.oForm = poForm

This one is really more complex because it searches the array property for the form name and handles getting the form in the array as well.

Finally in the form's Destroy I;

THISFORM.Creator.KillForm(THISFORM.Name)

The KillForm method of the application will take the form out of the array and if the form is the current form it will NULL the oForm property.

This removes the dependency on the non property variables for the form. The LaunchForm method can use the loForm variable until the form gets registered. Once the form is up and running I no longer need the variable because the oForm property points to the form.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform