Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Cetin Basoz
  Where is Cetin Basoz?
 Izmir
 Turkey
 Cetin Basoz
 To: Can Gökmen
  Where is Can Gökmen?
 Istanbul
 Turkey
 Can Gökmen
 Tags
Subject: RE: Form doesn't return to Menu
Thread ID: 345125 Message ID: 345205 # Views: 57 # Ratings: 1
Version: Visual FoxPro 9 SP2 Category: VFP and .NET
Date: Sunday, May 20, 2012 3:53:12 PM         
   


> Hi,
> I have following app structure. Wenn I click bar1, form1 shows OK. Wenn I click Close button on the form I want the control goes back to the menu, so I can click another menu item. However, something is missing in the structure. Can someone help me? Thanks.
>
> --------------------------
> PROCEDURE main1
> ON SHUTDOWN CLEAR EVENTS
> DO setup1
> DO menu1
> ENDPROC
> *****************************
> PROCEDURE setup1
> CLEAR
> PUSH MENU _MSYSMENU
> SET SYSMENU SAVE
> SET SYSMENU TO
> RETURN
> ENDPROC
> *****************************
> PROCEDURE menu1
> DEFINE MENU mnu BAR AT LINE 0
> DEFINE PAD pad1 OF mnu PROMPT "Pad1"
> ON PAD pad1 OF mnu ACTIVATE POPUP pop1
> DEFINE POPUP pop1 MARGIN RELATIVE
> DEFINE BAR 1 OF pop1 PROMPT "Bar1"
> ON SELECTION BAR 1 OF pop1 DO bar1
> DEFINE BAR 2 OF pop1 PROMPT "Bar2"
> ON SELECTION BAR 2 OF pop1 DO bar2
> DEFINE PAD padExit OF mnu PROMPT "Exit"
> ON SELECTION PAD padExit OF mnu DO Exit1
> ACTIVATE MENU mnu
> READ EVENTS
> DEACTIVATE MENU mnu
> RELEASE MENUS mnu EXTENDED
> SET SYSMENU TO DEFAULT
> POP MENU _MSYSMENU
> RETURN
> ENDPROC
> *********************************
> PROCEDURE Bar1
> lobar1 = NEWOBJECT("frmbar1")
> lobar1.Show(1)
> RETURN
>
> DEFINE CLASS frmbar1 AS Form
> Caption = "Bar1"
> Autocenter = .T.
> PROCEDURE Load
> RETURN
> ENDPROC
> ADD OBJECT ClsBtn AS CommandButton WITH ;
> Name = "ClsBtn", ;
> Caption = "Close It", ;
> Height = 25
> PROCEDURE ClsBtn.Click
> THISFORM.Release
> ENDPROC
> ENDDEFINE
> ENDPROC
> *************************************
> PROCEDURE Bar2
> RETURN
> ENDPROC
> *************************************
> PROCEDURE Exit1
> CLEAR EVENTS
> RETURN
> ENDPROC
> *****************************

Can,
You would need a loop to reactivate that menu. Instead create and use a system menu. ie:

Procedure Main1
	On Shutdown Clear Events
	Do menu1
	Read Events
	Set Sysmenu To Default
Endproc

*****************************
Procedure menu1
	Set Sysmenu To
	Set Sysmenu Automatic

	Define Pad bar1 Of _Msysmenu Prompt "Pad1"
	Define Pad padexit Of _Msysmenu Prompt "Exit"
	On Pad bar1 Of _Msysmenu Activate Popup pad1
	On Selection Pad padexit Of _Msysmenu Do exit1

	Define Popup pad1 Margin Relative Shadow
	Define Bar 1 Of pad1 Prompt "Bar1"
	Define Bar 2 Of pad1 Prompt "Bar2"
	On Selection Bar 1 Of pad1 Do bar1
	On Selection Bar 2 Of pad1 Do bar2
Endproc
*********************************
Procedure bar1
	lobar1 = Newobject("frmbar1")
	lobar1.Show(1)
Endproc

Define Class frmbar1 As Form
	Caption = "Bar1"
	AutoCenter = .T.
	Procedure Load
		Return
	Endproc
	Add Object ClsBtn As CommandButton With ;
		Name = "ClsBtn", ;
		Caption = "Close It", ;
		Height = 25
	Procedure ClsBtn.Click
		Thisform.Release
	Endproc
Enddefine
Endproc
*************************************
Procedure bar2
	Return
Endproc
*************************************
Procedure exit1
	Clear Events
Endproc
*****************************




Cetin Basoz

.Net has got better.Think about moving - check my blog:
My Blog
Blog (mirror) - sounds to be down


Support Wikipedia

ENTIRE THREAD

Form doesn't return to Menu Posted by Can Gökmen @ 5/18/2012 4:22:26 PM
RE: Form doesn't return to Menu Posted by mk sharma @ 5/19/2012 4:13:05 AM
RE: Form doesn't return to Menu Posted by Can Gökmen @ 5/22/2012 10:12:13 AM
RE: Form doesn't return to Menu Posted by Stefan Wuebbe @ 5/20/2012 11:20:02 AM
RE: Form doesn't return to Menu Posted by Can Gökmen @ 5/22/2012 9:57:50 AM
RE: Form doesn't return to Menu Posted by Stefan Wuebbe @ 5/22/2012 8:21:01 PM
RE: Form doesn't return to Menu Posted by Cetin Basoz @ 5/20/2012 3:53:12 PM
RE: Form doesn't return to Menu Posted by Can Gökmen @ 5/22/2012 10:20:15 AM
RE: Form doesn't return to Menu Posted by Cetin Basoz @ 5/22/2012 1:59:45 PM
RE: Form doesn't return to Menu Posted by Tamar Granor @ 5/22/2012 10:32:34 PM
RE: Form doesn't return to Menu Posted by Can Gökmen @ 5/23/2012 8:57:23 AM