Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Form class with CREATEOBJECT quickly closes when reshown
Message
From
31/01/2003 14:23:01
 
 
To
31/01/2003 13:50:36
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00747778
Message ID:
00747794
Views:
12
Hi Inge,

What is the code that creates the main menu form? I assume that you haven't done anything to stop execution of that program. The variable to which you are creating the main menu form is going out of scope and the form is evaporating.

Try putting a READ EVENTS after the line of code that creates the main menu form. Then you won't have to display it modally and you can hide and show it at will. Just be sure there is a button on the main menu (such as an exit button) that issues a CLEAR EVENTS to allow the program to exit.

pamela
************************
>My main menu is a form class. I used CREATEOBJECT & .Show(1) to bring the menu up. When user selects an item from the menu & click on the OK command button, the main menu is hidden (.hide) & a different form class is brought up (CREATEOBJECT & .Show(1)). This other form has pageframe with multi pages, grids, editbox, listbox, etc. When user clicks on a button to go back to main menu, this 2nd form is released (.release), and the main menu should be back up (.show). But that does not happen. The main menu comes back up but quickly dissapear/closes. I’ve read somewhere that there is a problem with modal forms created with CREATEOBJECT, & the solution is to put THISFORM.SHOW(1) at end of INIT() method & THISFORM.HIDE() at line before THISFORM.RELEASE() in whatever method which releases the form. I tried putting those lines into my main menu form class & it works 1 time: user selects the 2nd form from the main menu, the 2nd form is brought up, user clicks to go back to main menu, & voilla
>. . . the main menu comes up & stays. But the 2nd time around when user clicks on an option which brings up the other form again, & then goes back to main menu: the main menu quickly closes. Anybody have any info? I’ve tried to open up a different form class from the main menu (a simpler form), & had no trouble going back & forth between the main menu & the other form (I used the same methods). Why would it work for 1 form but not for another?
>
>In main menu’s cmdOK.Click (user selected an option, then clicked on OK button):
>THISFORM.HIDE
>oForm1=CREATEOBJECT("form1",xParameter)
>oForm1.SHOW(1)
>THISFORM.SHOW
>
>In form1’s cmdMainMenu.Click (user click on this button to go back to main menu):
>Thisform.Release
>
>Thank you all!
Previous
Reply
Map
View

Click here to load this message in the networking platform