Jump to content
  • Advertisement
Sign in to follow this  
Conqueran

Creating a submenu within a Pop-up menu

This topic is 4614 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'd like to create a submenu within a popup menu using c++. I have this so far HMENU hmenu; //set up pop-up menu hmenu = CreatePopupMenu(); InsertMenu(hmenu, 0, NULL, 1000, "Default View Point"); InsertMenu(hmenu, 1, NULL, 1001, "Fog Options" ); InsertMenu(hmenu, 2, NULL, 1002, "Texture Mapping" ); InsertMenu(hmenu, 3, NULL, 1003, "Shadow" ); InsertMenu(hmenu, 4, NULL, 1004, "Blending Shadow" ); InsertMenu(hmenu, 5, NULL, 1005, "Quit" ); InsertMenu(hmenu, 6, NULL, 1006, "Wire Frame" ); InsertMenu(hmenu, 7, NULL, 1007, "Shading" ); InsertMenu(hmenu, 8, NULL, 1008, "Lighting" ); This creates a menu with 9 different items... However I want the "Fog Options" choice to be a menu itself! When its selected I'd like a new menu to show to the right.. Just like windows does with menus often.. How do I do this using InsertMenu?

Share this post


Link to post
Share on other sites
Advertisement
Create the submenu (with another CreatePopupMenu call). Then call InsertMenu with MF_POPUP as the flags parameter, and your submenu's handle in the id parameter.

Share this post


Link to post
Share on other sites
I tried this but I get the following error.

HMENU hmenu, ShadowMenu; //set up pop-up menu
hmenu = CreatePopupMenu();
ShadowMenu= CreatePopupMenu();

InsertMenu(hmenu, 0, NULL, 1000, "Default View Point");
InsertMenu(hmenu, 1, MF_POPUP, ShadowMenu, "Fog Options");
InsertMenu(hmenu, 2, NULL, 1002, "Texture Mapping" );
............
..........
..........
...........

'InsertMenuA' : cannot convert parameter 4 from 'struct HMENU__ *' to 'unsigned int'

Share this post


Link to post
Share on other sites
You'll have to cast it like so:

InsertMenu(hmenu, 1, MF_POPUP, (UINT_PTR)ShadowMenu, "Fog Options");

(UINT_PTR is typedef'd as WPARAM, which is typedefed as unsigned int)

edit - case = cast


[Edited by - Dave Hunt on November 29, 2005 11:38:23 AM]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!