Default Access Key Behavior

  • Thread starter Thread starter Seigfried
  • Start date Start date
S

Seigfried

I've been reading the Microsoft Press book "Visual Basic .NET Step by Step"
(Michael Halvorson). I've noticed something about menu items while reading
chapter 4 that I didn't know before. Please try this:

1 - Create a new Windows Application

2 - Add a MainMenu component and then a single top level menu and two menu
items under it. Mine looked like this:

Whatever <- Top Level menu item
A Menu Item <- First sub menu item
B Menu Item <- Second sub menu item

3 - Add MsgBox statements to the Click events for each sub menu items to
indicate when the event is executed.

DO NOT add access key identifiers (&) or do anything else.

Now run the application. Notice that if you ...
Press and release the Alt key
press W, then A, you get the first MsgBox
press W, then B, you get the second MsgBox

You don't need to specify access keys. The first letter of the string in the
Text property is used!

How long has this been the default behavior?

Also ... does anyone know how to contact Michael Halvorson to ask him about
this?

(using Windows XP, VB.NET 2003)
 
* "Seigfried said:
(Michael Halvorson). I've noticed something about menu items while reading
chapter 4 that I didn't know before. Please try this:

1 - Create a new Windows Application

2 - Add a MainMenu component and then a single top level menu and two menu
items under it. Mine looked like this:

Whatever <- Top Level menu item
A Menu Item <- First sub menu item
B Menu Item <- Second sub menu item

3 - Add MsgBox statements to the Click events for each sub menu items to
indicate when the event is executed.

DO NOT add access key identifiers (&) or do anything else.

Now run the application. Notice that if you ...
Press and release the Alt key
press W, then A, you get the first MsgBox
press W, then B, you get the second MsgBox

You don't need to specify access keys. The first letter of the string in the
Text property is used!

How long has this been the default behavior?

This is not the default behavior and it doesn't work in other Windows
applications. I would consider this to be a bug, but let's say what the
others say.
 
Seigfried said:
DO NOT add access key identifiers (&) or do anything else.

Now run the application. Notice that if you ...
Press and release the Alt key
press W, then A, you get the first MsgBox
press W, then B, you get the second MsgBox

You don't need to specify access keys. The first letter of the string
in the Text property is used!

How long has this been the default behavior?

I'm not sure, but I think from the beginning - my beginning was Win 3.0.
(not mine but the first Win version I've been using *g*). At least since
Win95.

--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html
 
Herfried K. Wagner said:
This is not the default behavior and it doesn't work in other Windows
applications. I would consider this to be a bug, but let's say what the
others say.

I have a confirmation from a VB6SP5 user already that it works exactly like
that on his system.

Why do you say it's not default behavior? Did you try it?
 
* "Seigfried said:
I have a confirmation from a VB6SP5 user already that it works exactly like
that on his system.

Why do you say it's not default behavior? Did you try it?

Sorry, for some reason, I got a wrong result with my previous tests.
Yes, this will work as you describe if there is no other menu item with
the same key defined as access key and if there is no access key defined
in the item.
 
Back
Top