Attaching popup menu to an existing menu
-
Hello, I have creating a window with my menu which done in the following code CreateMenu(); AppendMenu(MF_STRING, id_Data, "Data"); AppendMenu(MF_STRING, id_Edit, "Edit"); AppendMenu(MF_STRING, id_Entity, "Entity"); The above code works fine. Now I want to add a popup menu to Data menu How should I do That ? Thanks Pritha
-
Hello, I have creating a window with my menu which done in the following code CreateMenu(); AppendMenu(MF_STRING, id_Data, "Data"); AppendMenu(MF_STRING, id_Edit, "Edit"); AppendMenu(MF_STRING, id_Entity, "Entity"); The above code works fine. Now I want to add a popup menu to Data menu How should I do That ? Thanks Pritha
Hi Paritha, Here is a sample code:
CMenu menu; menu.CreatePopupMenu(); menu.AppendMenu(MF_STRING, 10, "item 1"); CPoint pt; GetCursorPos(&pt); //Now, create the submenu CMenu menu1; menu1.CreatePopupMenu(); menu1.AppendMenu(MF_STRING, 11, "Item 1 in submenu1"); //attach the submenu to main menu menu.AppendMenu(MF_POPUP, (UINT_PTR)menu1.m_hMenu, "Submenu1"); menu.TrackPopupMenu(TPM_RETURNCMD, pt.x, pt.y, this);
Hope that helps. Kiran. -
Hello, I have creating a window with my menu which done in the following code CreateMenu(); AppendMenu(MF_STRING, id_Data, "Data"); AppendMenu(MF_STRING, id_Edit, "Edit"); AppendMenu(MF_STRING, id_Entity, "Entity"); The above code works fine. Now I want to add a popup menu to Data menu How should I do That ? Thanks Pritha
prithaa wrote:
AppendMenu(MF_STRING, id_Data, "Data"); AppendMenu(MF_STRING, id_Edit, "Edit");
perform same on hadle return after call of AppendMenu
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers, Alok Gupta VC Forum Q&A :- I/ IV Support CRY- Child Relief and You
-
prithaa wrote:
AppendMenu(MF_STRING, id_Data, "Data"); AppendMenu(MF_STRING, id_Edit, "Edit");
perform same on hadle return after call of AppendMenu
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers, Alok Gupta VC Forum Q&A :- I/ IV Support CRY- Child Relief and You
Hello, Thanks for your replies And the code given by kiran did not work for me because I already have a menu with 3 menu options and now I want one of the menu options to have a popup menu attached to it which earlier was MF_STRING. CMenu M; M.CreateMenu M.AppendMenu(MF_STRING, id_DAta, "Data"); M.AppendMenu(MF_STRING, id_Edit, "Edit"); M.AppendMenu(MF_STRING, id_Model, "Model"); Now the above works. How should I have popup menu like the following attached to Data. I do not want to add to the 3 menu options above CMenu M1; M1.CreatePopupMenu M1.AppendMenu(MF_STRING, id_Data1, "Data1"); M1.AppendMenu(MF_STRING, id_Data2, "Data2"); M1.AppendMenu(MF_STRING, id_Data3, "Data3"); Thanks Prithaa