tsmolskow
asked on
C# Windows Form Menu Problem
I'm using C# Windows Form Menu control, and I have added short cuts using the "&" symbol, and the short cuts show at design time (as underlined letters) but they don't show at run time. What am I doing wrong?
ASKER
Hey Nayer, I just tried that but no luck, they don't show up and the don't function (for example, pressing Alt+F does not open the file menu).
If the Text property is "&File" (as an example), then when you press the Alt key, the F letter will get underlined. Next, when you press F (while holding down the Alt key), the menu gets opened.
_______________
Nayer Naguib
_______________
Nayer Naguib
ASKER
Right, that is how I have it, and that is how it is suppose to work, but it's not working.
As far as I know, you can do *nothing* to disable this feature! Even when the menu item is disabled, the Alt+Key combination selects the menu item!
Try to do this: place the following line of code in the Form Load event handler. It should put the shortcut character of the specified menu item in the titlebar of the form.
Text=myMenu.MenuItems[some Index].Mne monic.ToSt ring();
Replace myMenu with the name of your menu, and someIndex with any valid item index.
Another thing to check: Try to press Alt+F (or any other combination) while using any Windows application (such as Internet Explorer), and Make sure that some letter is underlined.
_______________
Nayer Naguib
Try to do this: place the following line of code in the Form Load event handler. It should put the shortcut character of the specified menu item in the titlebar of the form.
Text=myMenu.MenuItems[some
Replace myMenu with the name of your menu, and someIndex with any valid item index.
Another thing to check: Try to press Alt+F (or any other combination) while using any Windows application (such as Internet Explorer), and Make sure that some letter is underlined.
_______________
Nayer Naguib
ASKER
like this (?):
Text= menuFile.MenuItems[1].Mnem onic.ToStr ing();
Text= menuFile.MenuItems[1].Mnem
Are you using multiple MenuItem controls on the same form?
You should use only one control, and use it add *all* required menus and submenus.
You cannot have menuFile, menuEdit, menuView, etc...
You should have one control (for example, mainMenu). You can use mainMenu.MenuItems[index1] to access main menu items (such as File, Edit, etc...), and mainMenu.MenuItems[index1] .MenuItems [index2] to access submenus (such as New, Open, Save submenus of the File menu).
If that is your problem, create a new empty project, and try using only one MainMenu control. Trying to modify your current project by removing additional MainMenu controls will possibly not work.
_______________
Nayer Naguib
You should use only one control, and use it add *all* required menus and submenus.
You cannot have menuFile, menuEdit, menuView, etc...
You should have one control (for example, mainMenu). You can use mainMenu.MenuItems[index1]
If that is your problem, create a new empty project, and try using only one MainMenu control. Trying to modify your current project by removing additional MainMenu controls will possibly not work.
_______________
Nayer Naguib
ASKER
Hey Nayer, Well I'm just using the MS MainMenu control, not any of the others, but I'm also using some third party components, but they don't have a menu component, just a tool bar component. I'll try a whole new project without the components, and LYK. Thanks for hanging in there, I really need to solve this mystery. BTW, this project has to be in 1.1, I know 2.0 is an improvement, but I can't use that right now.
ASKER
Well, the test project performs as you described, so it's possibly related to the components - at least that's my best guess, your thoughts?
I was not talking about using other types of controls, but rather about having multiple MainMenu controls on one form. This does not work.
If that is what you were doing, then most probably this is your problem.
_______________
Nayer Naguib
If that is what you were doing, then most probably this is your problem.
_______________
Nayer Naguib
ASKER
No, I double checked through the designer and code editor, I have only one MainMenu control
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
That's my thought - I will check with the vendor to see if there is a trouble ticket work around...
_______________
Nayer Naguib