How to keep menu navigation on MDI parent form's main menu?

G

Guest

I am working on an MDI Windows Forms application using C# and VS.NET 2003.
The main form has a MainMenu with several MenuItems. The child forms
displayed in the main form's client area do not have menus.

The problem is that when the main menu is activated by pressing the Alt key
and the user navigates through the main menu using the left and right arrows,
the focus can "fall off" of the main menu items and seems to disappear.
However, the focus has actually moved to the menu associated with the title
bar (right-click of the icon) of the main form or the title bar of the
currently active child form.

Is there a way to constrain the navigation to the main menu of the main form?

Thanks,
Dave
 
J

Jeffrey Tan[MSFT]

Hi Dave,

Thanks for your post.

Yes, I see your requirment. What you want is just the behavior of IE,
Outlook another some other applications' behavior.

However, if we use SPY++ to view IE or Outlook's menu, we can see that it
is not the standard win32 menu resource. It is just a customized
ToolBarWindow which contains the menus. So what you wanted is completed by
a customized Menu Window, not the standard Win32 main menu resource.

For any application using the standard Win32 main menu resource, jumping to
the system menu is the default behavior .

Hope this helps.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
G

Guest

Jeffrey,

Thanks for your reply. If I were to use a ToolBarWindow as a customized
Menu Window would I still be using MenuItems such that menu item shortcuts
would still be functional and menu navigation would still be familiar to the
user?

Can you point me to a good reference or example of using a ToolBarWindow as
a customized Menu Window?

Thanks,
Dave
 
J

Jeffrey Tan[MSFT]

Hi Dave,

Thanks for your feedback.

Creating a IE like menubar is a non-trivial work. We should apply certain
style to Toolbar, then handle keyboard/mouse navigation. The MSDN link
below described the steps:
"Creating an Internet Explorer-style Menu Bar "
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/pla
tform/commctls/faq/iemenubar.asp

Currently, I can not find any C# sample for this.

Thanks for your understanding.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
G

Guest

Jeffrey,

I looked at the link you provided, and no, this is not the direction I would
want to go.

Is there any way I could override the MenuItem and detect when the arrow key
is about to cause the menu to go "off the end"?

or

Can you find any links to a .NET solution to this problem?

Thanks,
Dave
 
J

Jeffrey Tan[MSFT]

Hi Dave,

Just as I stated in original post, the normal main menu's behavior do the
navigation to the system menu. If you want to get the same behavior as IE
menu bar, we should use the same way like IE, that is creating a IE menubar
like Toolbar. And currently, .Net did not provide buld-in support for this.

Thanks

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
G

Guest

Jeffrey,

Okay, then two questions:

1. Will VS.NET 2005 provide a way to do this?
2. Can I make it so the MDI child forms do not have a system menu?

Thanks,
Dave
 
J

Jeffrey Tan[MSFT]

Hi Dave,
1 . Will VS.NET 2005 provide a way to do this?
Because this is default behavior of main menu, it is not a problem of
VS.net2003, I do not think VS.net2005 will do any progress to it. If you
really need this, I suggest you submit your request to our product team
through the link below:
http://lab.msdn.microsoft.com/productfeedback/
2. Can I make it so the MDI child forms do not have a system menu?
Yes, although we can set Form.ControlBox to false to get rid of the system
menu, however, this will block the menu navigation, and will not get the
result you want.

Thanks

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
G

Guest

Jeffrey,

As for your reply to my second question, I have used child forms that have
their ControlBox disabled and their system menu is still activated by cycling
through the menu using the left and right arrow keys. In fact, it leaves a
little box on the title bar where the child form's icon would have appeared.
Kind of ugly!

I guess we're done with this item since there doesn't seem to be a
reasonable way to get the behavior I need. I guess my customers will just
have to get used to the default behavior of main and system menus.

Regards,
Dave

"Jeffrey Tan[MSFT]" said:
Hi Dave,
1 . Will VS.NET 2005 provide a way to do this?
Because this is default behavior of main menu, it is not a problem of
VS.net2003, I do not think VS.net2005 will do any progress to it. If you
really need this, I suggest you submit your request to our product team
through the link below:
http://lab.msdn.microsoft.com/productfeedback/
2. Can I make it so the MDI child forms do not have a system menu?
Yes, although we can set Form.ControlBox to false to get rid of the system
menu, however, this will block the menu navigation, and will not get the
result you want.

Thanks

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
J

Jeffrey Tan[MSFT]

Hi Dave,

Yes, I think currently, we'd better live with the default behavior of Main
menu. Thanks

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 

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