Shortcut Keys on Forms
-
I'm developing Windows Applications under Visual Studio 2005. I've noticed that when radio buttons, check boxes or command buttons have the focus on a form, all I need to do is press the letter assigned as a shortcut key for another control for that other control to receive the focus. I really do not want that behavior, I want the user to always have to press Alt-letter for a control with a shortcut key to get the focus (when a text box has the focus, the user does have to press Alt-letter for focus to change to another control). Can anyone tell me what I need to do to ensure that the user has to press Alt-letter to set focus to a new control when a radio button, check box or command button has the focus? Thank you...
-
I'm developing Windows Applications under Visual Studio 2005. I've noticed that when radio buttons, check boxes or command buttons have the focus on a form, all I need to do is press the letter assigned as a shortcut key for another control for that other control to receive the focus. I really do not want that behavior, I want the user to always have to press Alt-letter for a control with a shortcut key to get the focus (when a text box has the focus, the user does have to press Alt-letter for focus to change to another control). Can anyone tell me what I need to do to ensure that the user has to press Alt-letter to set focus to a new control when a radio button, check box or command button has the focus? Thank you...
use the & sign for the letter (in the text of that control) you want to use as a shortcut, and it will work with the Alt key. e.g btn1.Text = "&button" so the shortcut for btn1 will be 'Alt+b' regards
sAqIb "Our scientific power has outrun our spiritual power. We have guided missiles and misguided men." Dr. Martin Luther King Jr.
-
use the & sign for the letter (in the text of that control) you want to use as a shortcut, and it will work with the Alt key. e.g btn1.Text = "&button" so the shortcut for btn1 will be 'Alt+b' regards
sAqIb "Our scientific power has outrun our spiritual power. We have guided missiles and misguided men." Dr. Martin Luther King Jr.
I'm afraid I either posted my original question very poorly, or you misunderstood. I know how to create a shortcut key, my problem is that when a control other than a text box control has the focus, the user does not have to press the Alt key to go to another control that has a shortcut (or accelerator) key. For example, assume the command buttons below where btn1 has the shortcut set to "b", and btn2 has the shortcut set to "u" btn1.Text = "&button1" btn2.Text = "b&utton2" If btn2 currently has the focus, the user only has to press the letter "b" for btn1 to get the focus. I would prefer if the user always had to press the "Alt" key before any shortcut is activated but as long as the focus is not on a textbox, the "Alt" keys is apparently now unnecessary. I know I can tackle this issue by ensuring the Alt key is pressed in the KeyDown event of non-textbox controls, but I'm hoping there is some global setting in Tools-Options that I do not know about that will quickly tackle this issue for any apps I may develop. Thank you...