Menu Command, Shortcut Keys, and Resources

Post Reply
dpaterso
Posts: 142
Joined: Tue Jan 24, 2006 9:45 am
Location: South Africa
Contact:

Menu Command, Shortcut Keys, and Resources

Post 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.
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post 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.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post 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
Post Reply