Page 1 of 1

Menu Command, Shortcut Keys, and Resources

Posted: Sun Feb 12, 2006 6:55 am
by dpaterso
Just discovered something interesting.

The shortcut key underline or prompt on a menu item is only displayed if the user presses the Alt key i.e. the current menu item is highlighted and the letter that you have defined using '&' as the shortcut key is underlined. If you just use the mouse to select menu items these shortcut key underlines or prompts are not dispayed.

OK so far.

But if you use the 'Resource' statement to display a small bitmap to the left of your menu item then that menu item has the shortcut key underline or prompt displayed always - regardless of whether or not you are using the mouse or have used the Alt key to access the menu.

The end result is that if you have used your mouse to access the menu only those menuitems that use a resource to display a bitmap to the left of the menuitem have the shortcut key underline or prompt displayed.

Any reason for this?

By the way: what is the correct / recommended size of bitmap to use for a menuitem prompt resource?

Regards,

Dale.

Posted: Sun Feb 12, 2006 8:15 am
by Antonio Linares
Dale,

The Windows API does not natively support to display a bitmap on a menuitem, so we use "ownerdraw" menuitems to paint the bitmap and the text on it. Thats where the difference comes from. We may need to check if there is a message that provides a chance to paint or not the shortcut underscore.

The bitmap size should be 16x16 pixels.

Posted: Sun Feb 12, 2006 8:19 am
by James Bott
This is an XP issue. XP by default has the alt key underlines turned off until you press the Alt key. You can change this, right-click on the desktop, then Appearance, Effects. Then uncheck the box.

James