By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,641 Members | 1,446 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,641 IT Pros & Developers. It's quick & easy.

How program function keys (e.g. F1, F2) in Windows app?

P: n/a
I'm writing a Windows app and want to associate function keys with some of
my menu items (e.g. Help (F1)) and buttons. How can I do this, please?

Thanks.
Mar 23 '06 #1
Share this Question
Share on Google+
7 Replies


P: n/a

Ronald S. Cook wrote:
I'm writing a Windows app and want to associate function keys with some of
my menu items (e.g. Help (F1)) and buttons. How can I do this, please?

Thanks.


For menu items - you simply set it's shortcut propertie to the function
key you want it to use...

--
Tom Shelton [MVP]

Mar 23 '06 #2

P: n/a
"Ronald S. Cook" <rc***@westinis.com> schrieb:
I'm writing a Windows app and want to associate function keys with some of
my menu items (e.g. Help (F1)) and buttons.


Menu items have a 'Shortcut' property which can be used to assign keyboard
shortcuts to them. Buttons support shortcuts by embedding an ampersand
character in their 'Text' property value, such as "&Save", which will make
Alt+S raise the button's 'Click' event.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Mar 23 '06 #3

P: n/a
"Ronald S. Cook" <rc***@westinis.com> schrieb
I'm writing a Windows app and want to associate function keys with
some of my menu items (e.g. Help (F1)) and buttons. How can I do
this, please?

Set the Shortcuts property for menus. Handle the KeyDown event at form level
(KeyPreview = True) to handle them without a menu.
Armin

Mar 24 '06 #4

P: n/a
So how can I assign a function key (e.g. F3) to a button?

Thanks.

"Armin Zingler" <az*******@freenet.de> wrote in message
news:OT**************@TK2MSFTNGP10.phx.gbl...
"Ronald S. Cook" <rc***@westinis.com> schrieb
I'm writing a Windows app and want to associate function keys with
some of my menu items (e.g. Help (F1)) and buttons. How can I do
this, please?

Set the Shortcuts property for menus. Handle the KeyDown event at form
level (KeyPreview = True) to handle them without a menu.
Armin

Mar 24 '06 #5

P: n/a
"Ronald S. Cook" <rc***@westinis.com> schrieb
So how can I assign a function key (e.g. F3) to a button?


You can not assign a function key to a button. You can handle the key at
Form level and call the same procedure that is called when the button is
clicked.
see also:

http://support.microsoft.com/default...b;en-us;839201
http://msdn.microsoft.com/library/en...teractions.asp

Armin

Mar 25 '06 #6

P: n/a
You can also use mybutton.performclick.
--
Dennis in Houston
"Armin Zingler" wrote:
"Ronald S. Cook" <rc***@westinis.com> schrieb
So how can I assign a function key (e.g. F3) to a button?


You can not assign a function key to a button. You can handle the key at
Form level and call the same procedure that is called when the button is
clicked.
see also:

http://support.microsoft.com/default...b;en-us;839201
http://msdn.microsoft.com/library/en...teractions.asp

Armin

Mar 26 '06 #7

P: n/a
"Dennis" <De****@discussions.microsoft.com> schrieb
You can also use mybutton.performclick.

Yes, you can, but I never suggest it because no button has been clicked.
Armin
Mar 27 '06 #8

This discussion thread is closed

Replies have been disabled for this discussion.