473,508 Members | 2,143 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

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
7 4144

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
"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
"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
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
"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
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
"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2767
by: Tommo | last post by:
Hello All, I am a still learning so be easy on me. I am trying to get some code to work that is using JS and Perl/CGI, I am using AS Perl and an Apache Server on XP as the webserver. Can anyone...
4
17458
by: Sean Connery | last post by:
Does someone know the syntax to detect when certain function keys are pressed?
0
2018
by: federico | last post by:
Hello, how can I make a program respond to another program's input request? For example, this code: Process.Start("unrar.exe", "e D:\temp\key.rar D:temp2") SendKeys.SendWait("test~") will...
8
17724
by: Alvin | last post by:
Right. I`m using Dev-Cpp, and I`m working on a game at this time in SDL (http://libsdl.org), and I`ve come across this error: ------------------------------------------ main.c: In function...
23
2351
by: JoeC | last post by:
I am a self taught programmer and I have figured out most syntax but desigining my programs is a challenge. I realize that there are many ways to design a program but what are some good rules to...
1
10120
by: Martijn Mulder | last post by:
/* I have problems detecting the Arrow Keys on a User Control. A control derived from System.Windows.Forms.Control neglects 'bare' Arrow Keys but does react on the combination <Altor <Ctrl+ Arrow...
4
7984
by: Mo | last post by:
Hi, I am writing a console application to send a key sequence to an old clunky application on a regular interval using the windows scheduler. I can get it to work if it is a windows form...
2
1648
by: mindscreen | last post by:
I want to use Right-Click menu of mouse in any form or anywhere in my program? How can I able to do this? I want that when user right-click on any button or form a special pop-up menu will appear...
0
7124
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
7326
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
7385
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
7498
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...
0
5629
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,...
1
5053
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4707
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
1558
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 ...
1
766
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.