Answered by:
TabControl + Hot Keys?

Question
-
Hi all.
It seems that when setting up a tab control page's tab caption I can add a "&" to the string and see the underline appear on the next letter indicating that you can use that letter as a hot key to switch to a particular tab. However, the hot key doesn't actually work. Is alt+<hotkey> functionality not supported for a TabControl in .Net?
Thursday, September 9, 2010 9:19 PM
Answers
-
I don't know how you got to make the "&" underline the letter, because I can't do it here with standard TabControl. Controls that support Mnemonics have the property "UseMnemonic", so you can set it to true.
If you wish that behaviour, you will need to implement it manually.
Regards,
Fábio
"To alcohol! The cause of and solution to all of life's problems." - Homer Simpson- Marked as answer by Helen Zhou Friday, September 17, 2010 2:10 AM
Thursday, September 9, 2010 9:58 PM -
Hello josborn777,
Are you sure that you make the "&" underline the next letter? To my knowledge .net TabControl doesn't support short cut for TabPage. That is to say one need to implement by oneself. Here are some ready method of doing this:
- Custom a new control from TabControl to support shortcut behaviour. Eg. tabControl with Hotkeys and Disabling individual tab pages features, it customized a tabControl from TabControl, by overriding its ProcessMnemonic to make the custom control support shortcut key.
- Use KeyDown event to track if Alt key is pressed to manually make a tab selection. Coding like this: Hotkey Assignments - Tab Control
- In the CodeProject, an article Applying Visual Styles to the TabControl in .NET 2.0 Applying the XP-look style with the hot key feature to the TabControl.
If you have any question, please feel free to let me know.
Regards,
Helen ZhouThis response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.
Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.- Marked as answer by Helen Zhou Friday, September 17, 2010 2:10 AM
Monday, September 13, 2010 7:05 AM
All replies
-
I don't know how you got to make the "&" underline the letter, because I can't do it here with standard TabControl. Controls that support Mnemonics have the property "UseMnemonic", so you can set it to true.
If you wish that behaviour, you will need to implement it manually.
Regards,
Fábio
"To alcohol! The cause of and solution to all of life's problems." - Homer Simpson- Marked as answer by Helen Zhou Friday, September 17, 2010 2:10 AM
Thursday, September 9, 2010 9:58 PM -
Hello josborn777,
Are you sure that you make the "&" underline the next letter? To my knowledge .net TabControl doesn't support short cut for TabPage. That is to say one need to implement by oneself. Here are some ready method of doing this:
- Custom a new control from TabControl to support shortcut behaviour. Eg. tabControl with Hotkeys and Disabling individual tab pages features, it customized a tabControl from TabControl, by overriding its ProcessMnemonic to make the custom control support shortcut key.
- Use KeyDown event to track if Alt key is pressed to manually make a tab selection. Coding like this: Hotkey Assignments - Tab Control
- In the CodeProject, an article Applying Visual Styles to the TabControl in .NET 2.0 Applying the XP-look style with the hot key feature to the TabControl.
If you have any question, please feel free to let me know.
Regards,
Helen ZhouThis response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.
Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.- Marked as answer by Helen Zhou Friday, September 17, 2010 2:10 AM
Monday, September 13, 2010 7:05 AM