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

Disabling Function keys

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.