Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Stefan Wuebbe
  Where is Stefan Wuebbe?
 Hamburg
 Germany
 Stefan Wuebbe
 To: Manik Chamara
  Where is Manik Chamara?
 Mawanella
 Sri Lanka
 Manik Chamara
 Tags
Subject: RE: Create Popup Menu with Sub Menu
Thread ID: 310922 Message ID: 310932 # Views: 51 # Ratings: 2
Version: Visual FoxPro 9 SP2 Category: VFP and .NET
Date: Monday, June 27, 2011 11:21:56 AM         
   


> >
> > Hi,
> >
> > At which point do you have problems?
> > You can create a custom method, say on Form level, containing your Define Poupu/Bar code.
> > If yourGrid.AllowCellSelection=.F., you can call that custom method directly in yourGrid.RightClick()
> > If yourGrid.AllowCellSelection=.T., you'd need to put the method call into every column's current control RightClick(), either in the Form Designer or by using BindEvent() dynamically at run time.
> >
> >
> >
> > hth
> > -Stefan
>
>
> Thanks
> my question was how to add sub menu popup to the main menu item.When i click on the main menu items i wanna display the sub menus for the particular level.
>


Then Cetin's and Tushar's examples probably solved the problem already? Since the right-click code is running in the very moment when you click the Grid, you can fill the menu's "Prompt" strings dynamically, see also sample pasted below.


hth
-Stefan



LOCAL oForm as Form
oForm = CREATEOBJECT('TestForm')
oForm.Show(1)
RETURN

DEFINE CLASS TestForm as Form
	AutoCenter = .T.
	DataSession = 2
	PROCEDURE Load
		CREATE CURSOR temp (col1 C(10), col2 I)
		INSERT INTO temp VALUES ('One', 1)
		INSERT INTO temp VALUES ('Two', 2)
		GO TOP IN temp
	ENDPROC

	ADD OBJECT Grid1 as Grid WITH ;
		RecordSource = 'temp', ColumnCount = 2, AllowCellSelection = .F.
	PROCEDURE Grid1.RightClick
		Thisform.ShortcutMenu()
	ENDPROC

	PROCEDURE ShortcutMenu
		DEFINE POPUP sc SHORTCUT RELATIVE FROM MROW(),MCOL()
		DEFINE BAR 1 OF sc PROMPT "SubMenu"
		ON BAR 1 OF sc ACTIVATE POPUP sc2

		DEFINE POPUP sc2 SHORTCUT RELATIVE
		DEFINE BAR 1 OF sc2 PROMPT (TRIM(temp.col1))
		ON SELECTION BAR 1 OF sc2 Messagebox(temp.col2)

		ACTIVATE POPUP sc
ENDPROC

ENDDEFINE


ENTIRE THREAD

Create Popup Menu with Sub Menu Posted by Manik Chamara @ 6/27/2011 9:56:55 AM
RE: Create Popup Menu with Sub Menu Posted by Cetin Basoz @ 6/27/2011 10:29:53 AM
RE: Create Popup Menu with Sub Menu Posted by Manik Chamara @ 6/27/2011 10:43:35 AM
RE: Create Popup Menu with Sub Menu Posted by Cetin Basoz @ 6/27/2011 12:00:12 PM
RE: Create Popup Menu with Sub Menu Posted by Stefan Wuebbe @ 6/27/2011 10:30:36 AM
RE: Create Popup Menu with Sub Menu Posted by Manik Chamara @ 6/27/2011 10:46:19 AM
RE: Create Popup Menu with Sub Menu Posted by Stefan Wuebbe @ 6/27/2011 11:21:56 AM
RE: Create Popup Menu with Sub Menu Posted by Manik Chamara @ 6/27/2011 11:30:56 AM
RE: Create Popup Menu with Sub Menu Posted by Stefan Wuebbe @ 6/27/2011 11:58:23 AM
RE: Create Popup Menu with Sub Menu Posted by tushar @ 6/27/2011 10:54:46 AM
RE: Create Popup Menu with Sub Menu Posted by Manik Chamara @ 6/27/2011 11:23:49 AM
RE: Create Popup Menu with Sub Menu Posted by tushar @ 6/27/2011 11:38:45 AM
RE: Create Popup Menu with Sub Menu Posted by Manik Chamara @ 6/27/2011 11:49:13 AM