Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Form object lost when calling program
Message
From
22/10/2003 14:30:32
 
 
To
22/10/2003 14:18:39
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00841199
Message ID:
00841208
Views:
30
This message has been marked as the solution to the initial question of the thread.
I assume the intention of the DO WHILE .T. is to keep the menu shown. If so, then change your main to use READ EVENTS instead. This puts VFP into a state waiting for events to occur. Assuming the oBMENU object is declared earlier as either Private or Public, it will stay in scope, e.g.
** main
oBMENU = NEWOBJECT("MainMenu","chrommmainform.prg",'',lcBAckControl)
OBMENU.SHOW(1)
READ EVENTS
also assuming that when you close the OBMENU form, you want the app to close, in your OBMENU.Unload() event put
CLEAR EVENTS
You won't need the relase obmenu

>I am writing a system which uses a form with buttons as a main menu. When the uses selects a button a program is run (report, data input screen, etc.) and then they should return to the main form. I load the form as an object from main.prg. My problem is when I go to show the form again in the main.prg the object is no longer valid. This program works initally but crashes at OBMENU.SHOW(1) after it returns from running 'do ChrmReport'.
>
>
>*Main.prg
>oBMENU = NEWOBJECT("MainMenu","chrommmainform.prg",'',lcBAckControl)
>DO WHILE .t.
>	* display the menu
>	OBMENU.SHOW(1)
>enddo		
>RELEASE obmenu
>
>
>The code in the button being run is
>
>
>DEFINE CLASS cmdReport as label
>	NAME 	= "cmdReport"
>	caption	= 'REPORTS'
>	PROCEDURE CLICK
>		thisform.deactivate()
>		DO CHRMReport
>		thisform.activate()
>	ENDPROC
>ENDDEFINE
>
Insanity: Doing the same thing over and over and expecting different results.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform