Disabled menu items present their submenus (and even allow execution of submenu items)

H

hmoeller.privat

Excuse me for duping from
microsoft.public.dotnet.framework.windowsforms.controls, but that
groups seems to have too low a frequency for some answers to show
up...

One can very easily reproduce this behaviour:

1) Create a new Windows Forms project.
2) Add a MenuStrip from the Toolbox.
3) Add a "File" menu.
4) Add a menu item "Test1" below "File".
5) Add two submenu items "Test1.1" and "Test1.2" to the "Test1" menu.
6) Do 4) and 5) for a second menu, named "Test2". (Be sure to use
different names...)
7) Disable "Test1" (while leaving "Test2" enabled).
8) Start this application.
9) Open "File" menu and notice that Test1 is disabled and refuses to
show its submenu items.
10) Drag down to "Test2", which accordingly opens.
11) Drag back to "Test1" and notice its submenu opening up though it
is disabled.

When you extent this sample to call some MessageBox.ShowMessage with
the given menu item's Text property, you'll find out that those menu
items are even executable.

Is this a - probably well documented - bug or do I miss something very
basic?
 
R

Richard Lewis Haggard

I'll be darned. Good catch. I never noticed that before. I tried your
example and put another menu item between the two parent items and, if the
movement is quick, the disabled item's children still display. However, if
one hesitates just a fraction of a second over the intervening menu item,
then the disabled menu item properly fails to display its children. I'm
guessing that there is some sort of interaction between the two menu items
and the improperly displayed children are there because the system is still
looking at the enabled flag from the previous menu item. That is, of course,
just a wild supposition on my part.
 
T

Tony Wissler

I have deployed two major (at least to me) applications and I have seen the
same issue in both of those that you are mentioning.

I actually bugged me so much that in every application I built since, this
is one of the things I kept in the back of my mind to test against it.

Its sort of... funny... :(

Tony Wissler
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top