General information
Category:
Forms & Form designer
Title:
Form class with CREATEOBJECT quickly closes when reshown?
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!
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only