Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Very basic form problem
Message
From
22/10/2003 07:14:41
Andrew Fell-Gordon
Calypso Publications Ltd
Enfield, United Kingdom
 
 
To
18/10/2003 12:14:44
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00840010
Message ID:
00840952
Views:
24
The problem is that the form you are showing is created in the variable form2. This will cease to exist when the method that created it (button.click) has finished. One that variable ceases to exist the form is no more, hence it disappears.

If you start the form as modal (form2.show(1)) as John Jones suggests, then the button.click code is suspended while the modal form is showing. As the button.click code is only suspended the variable form2 still exists and therefore so does the form2 form.

If you do not want form2 to be modeless but still exist you will have to create it in a variable that exists independent of the button.click code. One way would be to declare the form2 variable as Public


PUBLIC form2
form2 = CreateObject("form2")
form2.Show


This is generally not to be recommended as public variables created on the fly can be seen and changed by everything in the application so they are inherently unsafe.

Alternatively add a property to the calling form and create the Form2 instance in it


Thisform.Form2Instance = CreateObject("form2")
Thisform.Form2Instance.Show


Again this has some problems, especially as any other code on the form will have to check whether Form2Instance has a form created in it or not.

Generally it is better if you are dealing with modeless forms to have some sort of launcher object that launches and tracks them.

Hope this helps

Andrew Fell-Gordon

>I don't think it being modal or modeless makes any difference. The second form still won't appear. I've tried it both ways...
>Are there any other commands or settings I should be using?
>
>Sharon
Previous
Reply
Map
View

Click here to load this message in the networking platform