473,386 Members | 1,819 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Access Keys for buttons - C#

I have posted a similar message and am reposting due to no response.
Basically, I need to know why using the ampersand to indicate an
access key for a button makes it so that simply entering the key alone
selects the button. It should be that the user must press Alt + the
access key. Note that this works also, it is just that I need it to
NOT select the button if the user enters JUST the access key.

My problem is that my application has a set of controls that need to
accept data from the user and whenever I type a key that is also an
access key for one of my buttons, that button gets selected.

I tried to create a new application with a form with just buttons on
it to make sure I didn't do anything to interfere with this mechanism.
I used the ampersand to indicate my access buttons and wrote handlers
for each button to display a popup message. Again, simply pressing the
access key alone selected the button. What is going on here? How can I
get this to work as expected where the user must enter Alt + the
access key?

Any tidbits of info are appreciated.

- Bruce
Nov 15 '05 #1
3 7381
Actually, for a button, all you need is the letter to activate a accelerator
key for a button. As far as I know, it's always been that way in Windows.
Fire up any normal windows app, open a dialog with a button with a keyboard
accelerator and hit the key (ex. Run Internet Explorer, go to Tools/Options,
go to the "Privacy" page, hit "v" (for Ad&vanced) and the advanced dialog
pops up). As long as the cursor isn't in a text box or combo box edit area,
it should work that way.

Pete
"BruceR" <br******@msn.com> wrote in message
news:e2**************************@posting.google.c om...
I have posted a similar message and am reposting due to no response.
Basically, I need to know why using the ampersand to indicate an
access key for a button makes it so that simply entering the key alone
selects the button. It should be that the user must press Alt + the
access key. Note that this works also, it is just that I need it to
NOT select the button if the user enters JUST the access key.

My problem is that my application has a set of controls that need to
accept data from the user and whenever I type a key that is also an
access key for one of my buttons, that button gets selected.

I tried to create a new application with a form with just buttons on
it to make sure I didn't do anything to interfere with this mechanism.
I used the ampersand to indicate my access buttons and wrote handlers
for each button to display a popup message. Again, simply pressing the
access key alone selected the button. What is going on here? How can I
get this to work as expected where the user must enter Alt + the
access key?

Any tidbits of info are appreciated.

- Bruce

Nov 15 '05 #2
br******@msn.com (BruceR) wrote in message news:<e2**************************@posting.google. com>...
I have posted a similar message and am reposting due to no response.
Basically, I need to know why using the ampersand to indicate an
access key for a button makes it so that simply entering the key alone
selects the button. It should be that the user must press Alt + the
access key. Note that this works also, it is just that I need it to
NOT select the button if the user enters JUST the access key.

My problem is that my application has a set of controls that need to
accept data from the user and whenever I type a key that is also an
access key for one of my buttons, that button gets selected.

I tried to create a new application with a form with just buttons on
it to make sure I didn't do anything to interfere with this mechanism.
I used the ampersand to indicate my access buttons and wrote handlers
for each button to display a popup message. Again, simply pressing the
access key alone selected the button. What is going on here? How can I
get this to work as expected where the user must enter Alt + the
access key?

Any tidbits of info are appreciated.

- Bruce


Just something else that I am noticing - pressing the Alt key PRIOR TO
entering the key seems to turn off the access key. Ie, each time I
press the Alt key before (not simultaneously) the access key, the
button is not selected. Is there some kind of Alt lock thing going on
here?
Nov 15 '05 #3
Hey Pete,

Thanks for taking the time to respond. Yeah, I know that this is the
default behavior, but for some reason in my C# app, things are
behaving a little strangely. I went ahead and created a simple little
C# application that just had a form with 3 buttons, where I set their
text to be &One, &Two and F&our. Then I wrote click handlers for them
that simply popped up a message box displaying one, two and four
respectively. When I ran the app, I was able to enter, without
simultaneously pressing the Alt key, "o", "t", "f" to select the
corresponding buttons.

I'd invite you to try the same (it only takes a few minutes) and let
me know if you get the same results. If you get it to work as expected
where just selecting the shortcut key alone does NOT select it let me
know.

- Bruce

"Pete Davis" <pd******@hotmail.com> wrote in message news:<49******************************@news.megane tnews.com>...
Actually, for a button, all you need is the letter to activate a accelerator
key for a button. As far as I know, it's always been that way in Windows.
Fire up any normal windows app, open a dialog with a button with a keyboard
accelerator and hit the key (ex. Run Internet Explorer, go to Tools/Options,
go to the "Privacy" page, hit "v" (for Ad&vanced) and the advanced dialog
pops up). As long as the cursor isn't in a text box or combo box edit area,
it should work that way.

Pete
"BruceR" <br******@msn.com> wrote in message
news:e2**************************@posting.google.c om...
I have posted a similar message and am reposting due to no response.
Basically, I need to know why using the ampersand to indicate an
access key for a button makes it so that simply entering the key alone
selects the button. It should be that the user must press Alt + the
access key. Note that this works also, it is just that I need it to
NOT select the button if the user enters JUST the access key.

My problem is that my application has a set of controls that need to
accept data from the user and whenever I type a key that is also an
access key for one of my buttons, that button gets selected.

I tried to create a new application with a form with just buttons on
it to make sure I didn't do anything to interfere with this mechanism.
I used the ampersand to indicate my access buttons and wrote handlers
for each button to display a popup message. Again, simply pressing the
access key alone selected the button. What is going on here? How can I
get this to work as expected where the user must enter Alt + the
access key?

Any tidbits of info are appreciated.

- Bruce

Nov 15 '05 #4

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

Similar topics

2
by: AlanF | last post by:
We have defined access keys for both our menu choices and buttons. However, when the menu displays, the access key "underline" on the menu does not display until we press the ALT key. We can toggle...
6
by: Peter Frost | last post by:
Please help I don't know if this is possible but what I would really like to do is to use On Error Goto to capture the code that is being executed when an error occurs. Any help would be much...
1
by: Aravindhan | last post by:
Hi, I had created a MS Access form. The form has an "Save" and a "Close" button. I would like to set short cut keys for these buttons as "Ctrl + S" and "Ctrl + C" keys. I heard that Send keys...
2
by: Jim S | last post by:
I am having a problem finding information regarding vb.net allowing you to create shortcut keys for buttons using the CTRL key + function buttons such as F1, F2 etc.. (Ex: Press CTRL+F1 to activate...
4
by: Neil Wallace | last post by:
Hi there, I have an application in which a grid of 100 or more buttons are put on a form in columns of 10. All the buttons are within a panel. They are added in runtime, and so they adopt a...
2
by: Phil Galey | last post by:
I have a Panel control docked on all sides on a form and the panel control contains a PictureBox. I'm using the KeyDown event of the form to respond to the and keys for resizing the image and the...
5
by: (PeteCresswell) | last post by:
User's screen has a "Sort By" option group on it with radio buttons for things like "Deal Name", "Collateral Manager", "Underwriter", Closing Date", "Holding Size", and so-on and so-forth. But...
1
by: perse981 | last post by:
Hi I need to know how, if even possible, to enable the user of my program to control the Size and Posisiton of the circle I have Drawn on the form by using the Enter Key (to increase size), Shift...
16
by: ImpactMan | last post by:
Need help to create an windows mobile application with a few buttons that when they are pressed/clicked they assign keys, like up, down, left, right. It is just like to create a "virtual d-pad",...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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
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
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...

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.