Disabling Menu Item with Submenus Can Disable Shortcut Keys

ID Number: Q77581

1.00

WINDOWS

buglist1.00

Summary:

If a menu item containing one or more submenus is disabled during run

time, the shortcut keys of subsequent menu items on the same level of

the same parent menu will no longer function. If the menu item is

disabled during design time (in the Menu Design window), all shortcut

keys will function properly at run time.

Microsoft has confirmed this to be a problem in Microsoft Visual Basic

programming system version 1.0 for Windows. We are researching this

problem and will post new information here as it becomes available.

More Information:

Steps to Reproduce Problem

--------------------------

1. Run Visual Basic. From the File menu, select New Project

(ALT, F, N). Form1 will be created by default.

2. From the Menu Design window, create the following menu structure on

Form1:

Menu1

....Item1

........Item1Subitem1

....Item2

Add the shortcut CTRL+I (or any other shortcut key) to the

menu item Item2. (To assign a function-key or control-key shortcut

to a menu command, select from the list in the Accelerator

drop-down list box in the Menu Design window. See page 120 of the

"Visual Basic: Programmer's Guide" version 1.0 manual for more

information.)

The actual menu on Form1 should look like this:

Menu1

---------

Item1 >

Item2 CTRL + I

3. Place a command button on Form1.

4. Place the following code in the Command1_Click event procedure:

Sub Command1_Click ()

Item1.Enabled = 0

End Sub

5. Place the following code in the Item2_Click event procedure:

Sub Item2_Click ()

Beep

Beep

Beep

End Sub

6. Press F5 to run the program.

7. From Menu1, choose Item2 by pressing the CTRL+I shortcut key

combination. The program should respond by beeping the computer's

internal speaker three times.

8. Click the command button labeled Command1.

Note: Item1 in Menu1 will now be disabled.

9. From Menu1, choose Item2 by pressing the CTRL+I key combination.

The program will NOT respond correctly (with three beeps). The

menu shortcut no longer causes an Item2_Click event to occur.

Note: If Item2 is selected from Menu1 with the mouse, the

program will respond correctly.

Additional reference words: 1.00