Link to home
Start Free TrialLog in
Avatar of JohnnyBCJ
JohnnyBCJFlag for Canada

asked on

How can I setup my menu strip to act in the following ways (VB.NET)

Depending on the value of a boolean variable, I want the menu item to act in the following ways:

If the value is false, I want the menu to act like it would normally.

If the value is true, I want to force the user to have to click on the main menu to display the menu list. I do not want the user to be able to hover their mouse over a main menu to see sub menu, even if a sub menu list is already displayed.

Here is the background reason why :

File <=== Main Menu
- Open <==== Sub menu
- Save <==== Sub menu
...

Here's the background information and reason why I need it to act this way

One of my menus have a very long list of sub menus. The user has to go through these lists from top to bottom in order. All sub menus open up a form. For example, I'll say the beginning of the menus is "A" and the last menu option is "Z".

When the user clicks on sub menu "A", a form appears.
When they close the form, the menu option they most recently clicked on is displayed with the most recent sub menu a different background color. This works great.

My problem is caused by three things:

1. my MDI style application has the minimized, restore, close buttons are located at the top left (not top right as normal).

2. My menu strip is on the top and is horizontal (left to right). The menu lasts two rows so when the user closes a form, they can't move anywhere without hovering the mouse over a different main menu.

3. When the user closes the form, the sub menu is displayed properly but when the user moves the mouse over a different main menu, that sub menu is displayed (making the most recently clicked on one disappear). I'm trying to prevent this.
Avatar of JohnnyBCJ
JohnnyBCJ
Flag of Canada image

ASKER

This is what I'm trying to accomplish.

Lets say you have these two file Menus.

File              Edit
- Open         - Undo
- Save          - Redo
...                  ...

By design, if you click on [File], the file menu displays. If you move the mouse over to the [Edit] field, the Edit menu displays without you having to click on [Edit]. I want to be able to turn on or off this function/ability. I want to be able to force the user to click on [file] to see the file menu and then click on [edit] to see the edit menu.


Thank you for your help. I greatly appreciate it. I still have not yet received any experts comments on this question. I never thought this question would be so hard to accomplish.
It doesn't seem like this question is going to get a response from the Experts.

I've somewhat came up with a work around to this problem but it doesn't accomplish what I want to do.

It is setup so that when the user closes a child form that last menu clicked is displayed and the mouse would go exactly where it was located when it opened up the child form.

I believe this will be the solution to my problem unless someone can come up with a better suggestion.
SOLUTION
Avatar of omegaomega
omegaomega
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I'm aware that EE may be having problems with the Accepting a comment as an answer so I am going to check on this in a couple of days so I can give you some points for your thoughts. Thanks again!


Hello, JohnnyBCJ,

Yes, I also tried looking for some "Override" either in a custom (MenuStrip or a custom ToolStripMenuItem) that would do the trick.  I even investigated overriding WndProc, but couldn't find a consistent combination of Window messages that could be used.

I too would NOT use the "solution" I illustrated.  So unless you get a better answer from someone else,  I suggest that you request the points be refunded.  (I'm not actually here for the points, anyway.)

Cheers,
Randy
I also tried the overriding WndProc as I'm already doing that to accomplish other things in my program. It seems like we're both in the same boat when it comes to this problem. I figured out of all the VB.Net programs made that this problem would have already been solved. It doesn't seem like it's "that hard" of a thing to accomplish.

I like giving credit where credit is due. Out of all the people who looked at my problem, you're the only one that gave me a suggestion. That deserves points in my book.