mfc >> Assigning same accelerator key to two mutually exlusive menu items

by abhi_junk » Mon, 26 Apr 2004 12:31:05 GMT

How do I assign same keyboard key to two menus in my application which
are mutually exclusive? i.e., if one is active, the other will always
be disabled and vice versa (it's an Audio Play/Stop menu)

I tried to assign the key to the two menu items (Play and Stop) via
Accerlarator table (resource editor), but it works only on one of the
menus. i.e. it works only for Play menu. After the audio starts
playing, I am enabling Stop menu and disabling Play menu (via
UPDATE_COMMAND_UI handlers), so I would expect the assigned keyboard
key to activate Stop menu (when it's playing). But that does not
happen.

Can someone please provide me a pointer?

Thanks
Abhijit

mfc >> Assigning same accelerator key to two mutually exlusive menu items

by Igor Green » Mon, 26 Apr 2004 13:50:31 GMT


> How do I assign same keyboard key to two menus in my application which

I would add shortcut to accelerator table for item like ID_TOGGLE_PLAY, and
in handler would decide what to do. Once you add this key to menu item
description (ex. Play\tF5) for user it's usage will be obvious. Things get a
bit harder if you have menu with automatic shortcut displaying (ex. when
shortcuts can be customized). I had this situation and it requires me to
take special steps to handle that special shortcuts.

Two items in accel.table will not work, since when key is pressed, table is
simply looked through to find _first_ usage of this key, than it is
processed.

mfc >> RE: Assigning same accelerator key to two mutually exlusive menu items

by R3VpdGFyQmlsbA » Mon, 26 Apr 2004 14:16:02 GMT

Just have one menu item and change the menu text.

Similar Threads

1. Force menu item shortcut key text without accelerator (VC9/MFC Feature Pack)

2. Missing menu accelerator key underscores

Hello

In a BCB5 project I have specified accelerator keys for most of the menu 
items and the underscores show up in the menu designer in design time but 
not on the actual menu and nor do they show up on the menu at run time. Has 
anyone had this problem ??

Thanks in advance



3. Shortcut key/Accelerator Key Problem - CSharp/C#

4. bold Main Menu Items and Popup Menu Items don't disply in Vista

Hi,
I use BCB 5
Combined with Mike L's Theme manager for XP style.

Yesterday I managed to download, install and check Vista public Beta.

The Menu Items which are bold (either in Main Menu or Popups) are always 
gone, they don't get displayed at all ?

Anybody else seen this ?
Has an explanation ?
Found a rememdy ? 


5. how to set a shortcut key on a menu item - CSharp/C#

6. a hot key to a menu item

Hi,

Just a simple question.  I have a menu item and I want to associate a 
hot key with it (like ctrl-p for printing).  Can someone just point a 
direction for me?  Thanks.

Tony

7. Twon Context Menu Extension Dlls - Mutually Exclusive on XP and Vista

8. Mutually Exclusive menu selections

How do I group a series of menu items so that one and only one can be 
checked? I know how to group a set of radio buttons on a dialog but I am 
confused about menu items:

File Edit   Setup    Window  Help
               type 1
               type 2
           ? type 3


Ron H.
-- 
This outgoing email was scanned by
Norton Antivirus Corp. Edition
and found to be virus free! 


-----------------
www.Newsgroup-Binaries.com - *Completion*Retention*Speed*
Access your favorite newsgroups from home or on the road
-----------------