473,396 Members | 1,879 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,396 software developers and data experts.

Disabling Function keys

Apologies if this has been covered recently - I lurked and saw nothing.

I have an application that does ticketing at a three-screen movie theatre,
and I'm using the function keys F1 thru F12 due to their intuitive layout.
I KeyPreview them to the form, and read them using the KeyDown event (since
KeyPress doesn't see non-ANSI keys). Everything works fine, EXCEPT.

After executing my code, a few of the keys go ahead with what they USUALLY
do (F1 brings up Help, F10 highlights the File menu choice, F11 brings up
the Database Window, and F12 does a Save As). I know I can disable F1=Help
at the OS level (XP here), but I don't want the user to have to do that on
his POS PC's. And the keys that act within Access (2000) have no apparent
way to disable them.

Is there something similar to CancelEvent that will stop the processing of a
keystroke after I'm done with it? Can I do this some other way?

Thanks for any ideas or novel approaches.

Armando

Nov 13 '05 #1
3 9117
Armando wrote:
Apologies if this has been covered recently - I lurked and saw nothing.

I have an application that does ticketing at a three-screen movie theatre,
and I'm using the function keys F1 thru F12 due to their intuitive layout.
I KeyPreview them to the form, and read them using the KeyDown event (since
KeyPress doesn't see non-ANSI keys). Everything works fine, EXCEPT.

After executing my code, a few of the keys go ahead with what they USUALLY
do (F1 brings up Help, F10 highlights the File menu choice, F11 brings up
the Database Window, and F12 does a Save As). I know I can disable F1=Help
at the OS level (XP here), but I don't want the user to have to do that on
his POS PC's. And the keys that act within Access (2000) have no apparent
way to disable them.

Is there something similar to CancelEvent that will stop the processing of a
keystroke after I'm done with it? Can I do this some other way?


No novel ideas. Set the KeyValue = 0 after you are done with it to
prevent further processing.

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Dim intAltDown As Integer

intAltDown = (Shift And acAltMask) > 0
'Debug.Print acAltMask, KeyCode
If intAltDown And KeyCode = 84 Then
Me.cmdAddNew.Visible = Not Me.cmdAddNew.Visible 'toggle button
KeyCode = 0 ' disable additional processing
End If

End Sub

--
'---------------
'John Mishefske
'---------------
Nov 13 '05 #2
In the KeyDown event, after you detect and process the keystroke, destroy
the keystroke by setting KeyCode to zero, i.e.:
KeyCode = 0

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Armando" <ar*****@bogusaddress.com> wrote in message
news:LE*******************@news1.epix.net...
Apologies if this has been covered recently - I lurked and saw nothing.

I have an application that does ticketing at a three-screen movie theatre,
and I'm using the function keys F1 thru F12 due to their intuitive layout.
I KeyPreview them to the form, and read them using the KeyDown event
(since
KeyPress doesn't see non-ANSI keys). Everything works fine, EXCEPT.

After executing my code, a few of the keys go ahead with what they USUALLY
do (F1 brings up Help, F10 highlights the File menu choice, F11 brings up
the Database Window, and F12 does a Save As). I know I can disable
F1=Help
at the OS level (XP here), but I don't want the user to have to do that on
his POS PC's. And the keys that act within Access (2000) have no apparent
way to disable them.

Is there something similar to CancelEvent that will stop the processing of
a
keystroke after I'm done with it? Can I do this some other way?

Thanks for any ideas or novel approaches.

Armando

Nov 13 '05 #3
A thousand thanks to John, Allen, and anyone else who may reply. It works
like a charm. This is the sort of trick I knew you guys would have stashed
away. Now I have it, too!

Merry Christmas to all,

Armando
Nov 13 '05 #4

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

Similar topics

1
by: Niels Borg | last post by:
Hi, I am building an app, where I would like to disable the standard windows function keys. I.E. F4 which expands a a selected drop-down list. Can anyone help me on that? Many thanks Niels...
1
by: Don W. | last post by:
I need to use some function keys as speed-keys (instead of clicking a button with the mouse.) Using this code doesn't display any codes for the function keys: <html><body> <SCRIPT...
1
by: Steve | last post by:
I would like to override the IsInputKey function in order to trap the arrow up/down keys in the Key Events. I understand that arrow keys don't have a char representation and thus, hard to trap. ...
4
by: Broeisi | last post by:
Hello, I'm trying to write a console based program in C in Linux. I want to use the function keys in my program, but I don;t know how to let the C program know when for exmaple the F1 key is...
1
by: apax999 | last post by:
Kinda new to SQL, using SQL Server 2005. I have some foreign keys in a couple of tables. I need to drop these tables, but can't since I'll get the error: Msg 3726, Level 16, State 1, Line...
1
by: Sam Samson | last post by:
Greeetings All .. For my users convenience I have mapped function keys F2 .. F12 to change the tabs on the Tabcontrol. Works like a charm <ominous musicuntil one hits F8</ominous music> ...
9
by: Wingot | last post by:
Hey, I am using Visual Studio 2008 Beta 2 for some application development in C#, but I presume that the following question applies equally well to any environment.
2
by: Gouri.Mahajan7 | last post by:
Hello, Can anybody please tell me how to disable the shortcuts of the internet explorer? I have hosted control on the web page and i want to give the inputs such as Ctrl+A, Ctrl+B and so on.....
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...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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
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...
0
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,...

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.