473,804 Members | 2,147 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 7399
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.c om> wrote in message
news:e2******** *************** ***@posting.goo gle.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

Nov 15 '05 #2
br******@msn.co m (BruceR) wrote in message news:<e2******* *************** ****@posting.go ogle.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******@hotma il.com> wrote in message news:<49******* *************** ********@news.m eganetnews.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.c om> wrote in message
news:e2******** *************** ***@posting.goo gle.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

Nov 15 '05 #4

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

Similar topics

2
2688
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 the access key underline display by hitting the ALT key again. How do we get the access keys to be underlined by default and stay underlined whether we hit the ALT key or not? Default behavior in VB6 was that the access keys always showed up...
6
4765
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 appreciated. Thanks in advance
1
2077
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 would work...But not sure How to use them in MS Access forms. Please provide me some information on How to proceed with this.
2
29142
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 a click event on a button). If anyone could help it would be sincerely appreciated. Thank You!
4
5895
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 sensible tab value. The tab key moves the focus down the column one by one, and the up and down arrow keys work well.
2
4177
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 PageUp, PageDn, Home, End, and arrow keys for scrolling the Panel control. Resizing the image using the and keys works fine, deriving a resized thumbnail from the image and reassigning it to the Image property of the PictureBox. However I'm...
5
3085
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 now the user wants to be able to choose up to three of those keys and have the resulting tree sorted by all three but in a specified order. My kneejerk something with checkboxes instead of radio buttons - and maybe a drop down next to each where...
1
2030
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 Key (to decrease size), and Arrow Keys (to alter posistion of circle on screen). My program consists of a single form with six command buttons and a circle that I drew with the shape control. For each of the command buttons I have written a click...
16
4106
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", or "software emulated d-pad". I'm newbie in programming, and I'm using Visual Studio 2008. Some one can help me with that? Tanks. My effort for it only result in this simple code lines:
0
9711
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10595
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10343
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10335
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10088
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9169
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
4306
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 we have to send another system
2
3831
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3001
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.