473,513 Members | 2,420 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

accelerator keys

Is there a way to duplicate the accelerator key for
controls which live on separate pages of a tab control.
i.e. to have a button called &Button1 on one tab and
another button called &Button2 on another tab, both
buttons have Alt-B as their accelerator?
Jul 19 '05 #1
2 2609
Hi Richard,

Thanks for your post.

Based on my experience and research, an accelerator key can only be mapped
to a control, other controls with the same accelerator will not take
effect. To work around this problem, I suggest that you can dynamically
chage the Text of the controls. Please refer to the following code snippet:

//-------------code snippet--------------------
private void tabControl1_SelectedIndexChanged(object sender,
System.EventArgs e)
{
if(this.tabControl1.SelectedTab.Text == "Tab1")
{
this.button1.Text = "&Button1";
this.button2.Text = "Button2";
}
else
{
this.button1.Text = "Button1";
this.button2.Text = "&Button2";
}
}
//---------------end of----------------------------

Hope this helps.

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! ¨C www.microsoft.com/security
This posting is provided ˇ°as isˇ± with no warranties and confers no rights.

Jul 19 '05 #2
Maybe this could be looked at as a feature request for future versions. It
would seem a reasonable thing to do - ignore invisible accelerators.

"Tian Min Huang" <ti******@online.microsoft.com> wrote in message
news:AX**************@cpmsftngxa06.phx.gbl...
Hi Richard,

Thanks for your post.

Based on my experience and research, an accelerator key can only be mapped
to a control, other controls with the same accelerator will not take
effect. To work around this problem, I suggest that you can dynamically
chage the Text of the controls. Please refer to the following code snippet:
//-------------code snippet--------------------
private void tabControl1_SelectedIndexChanged(object sender,
System.EventArgs e)
{
if(this.tabControl1.SelectedTab.Text == "Tab1")
{
this.button1.Text = "&Button1";
this.button2.Text = "Button2";
}
else
{
this.button1.Text = "Button1";
this.button2.Text = "&Button2";
}
}
//---------------end of----------------------------

Hope this helps.

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! ¨C www.microsoft.com/security
This posting is provided ˇ°as isˇ± with no warranties and confers no rights.

Jul 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2338
by: BruceR | last post by:
I have created an Outlook style bar in my C# application and have associated accelerator keys to my group/icon buttons by using the & key and setting UseMnemonic as appropriate. The problem is that...
4
1831
by: Roberto\(DOTNET\) | last post by:
Hi at all, i made a webapplication, and some pages have into its some dynamic control (UserControl). Now i would like to put some accelerator key to improve the fast of some operations. Is there a...
5
2417
by: Rich | last post by:
I typed &myBtn to display the underscore line on the first letter of <u>M</u> of myBtn. I can invoke &myBtn by pressing alt-m on the keyboard. But the underscore is not showing up. Is there a...
0
239
by: Richard | last post by:
Is there a way to duplicate the accelerator key for controls which live on separate pages of a tab control. i.e. to have a button called &Button1 on one tab and another button called &Button2 on...
1
3465
by: Csaba Gabor | last post by:
Short version: if the user types an alt+ctrl+char combination which leads to a defined character, but s/he's not in a input(text)/textarea, then I'd like that keystroke combination to do the same...
2
2506
by: Richard Lewis Haggard | last post by:
How does one specify the Escape key as an accelerator? My client has specified that the Escape key be used as an accelerator for a particular menu item. In VS05's designer mode, this particular...
2
2403
by: B. | last post by:
I have a C# winform with accelerator key associated with some menus. If my exe is in unmanaged C++ and the winform is invoked through interop, the accelerator key not working. If I create a new...
4
1857
by: ayan4u | last post by:
ok i have a main window hWnd and created an edit dialogue box as a child window(gEditBox) i have an acclerator table to access the menu items in hWnd when i am in the edit box nothing happens...
2
3206
by: killy971 | last post by:
I have been testing different libraries to process XSL transformations on large XML files. The fact is that I read a document from Intel, stating their library (XSLT accelerator) was more twice...
0
7259
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7158
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7380
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7535
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5683
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4745
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3221
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1592
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
455
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.