Jump to content
  • Advertisement
Sign in to follow this  

Win32 fullscreen popup menu behaving badly.

This topic is 2974 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

Using C++ in VS2008, I'm at the beginnings of a DirectX program which can so far display a token image and flip between fullscreen and windowed mode with no problems.

It has a menu bar, which goes invisible as expected in fullscreen mode. The ALT key still worked to activate this menu in fullscreen, but it was very clumsy since its items weren't visible until highlighted, and even then it only responded to about 1 in 5 presses of the ALT key.

So I decided to implement a popup menu instead, that responds to the right mouse button. My problem is that this popup menu is also temperamental in fullscreen mode. It also messes with the custom cursor I am using.

The wrong behaviour is defined as follows:

A right click anywhere will active the popup menu, but also deactive the custom cursor and replace it with the system default.

Once the menu is visible, RIGHT-clicking outside of the menu will deactivate it, but this leaves the default cursor on. However, right-clicking again will activate the menu again, and this continues perfectly if not for the missing custom cursor.

Once the menu is visible, LEFT-clicking outside of the menu will deactivate it, and this displays the custom cursor again. Now it gets a bit more messy because now:
3a· If I right-click, it will return to step 1. Menu on + cursor off.
3b· If I left-click a second time (as if I am gaining focus or something), then right-click, will will activate the default cursor but NOT active the menu (as if I half did and half didn't regain focus or something). Menu off + cursor off.
3c· If I move the mouse and then right-click, it will do one of the above. I can't determine why yet. Step 1 or step 3b. Menu on + cursor off, or menu off + cursor off. Frustrating.

The most visible problem is that once step 3b occurs (menu off + cursor off), the user can flip the custom cursor on and off forever. Left click on, right click off. Not only does the menu never appear, but this is simply not what I want a user to be seeing in my program... the cursor changing for no reason.

I imagine the cursor changing is to do with the menu itself taking focus or something like that. I would like that to be avoided if possible, but the real problem is why is the menu activation temperamental in the first place?

My code for the popup menu is:

30, 30, 0, g_parentWindow, NULL);
I don't think it has much to do with this really, but I don't know what else to look at.

One more thing. If I use F4 to active the menu instead, the cursor behaviour is similar but the menu almost never appears at all. However, I can click on the space where the menu should appear, and sometimes the "selected" option appears then vanishes again.

Problem 1: Can I make the menu activate reliably?
Problem 2: Can I stop the cursor from changing?
Problem 3: Why does a key command function even worse?

Thanks for the read. Any ideas?

Share this post

Link to post
Share on other sites
In fullscreen mode DirectX takes control of the screen completely, which means no other methods of drawing can share the screen reliably, including drawing a menu. If you want a menu in fullscreen, it is better if you draw it yourself using D3D draw commands.
If you want to use Windows menus, then you should stay in window mode. You could do this while still covering the entire screen, by running in window-mode but using a border-less top-most window covering the entire screen. This way you can still put windows and menus on top of your D3D app, as it won't be in true exclusive fullscreen mode.

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!