Disabling Function keys

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Armando

    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



  • John Mishefske

    #2
    Re: Disabling Function keys

    Armando wrote:[color=blue]
    > 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?[/color]

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

    Private Sub Form_KeyDown(Ke yCode 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.Vi sible = Not Me.cmdAddNew.Vi sible 'toggle button
    KeyCode = 0 ' disable additional processing
    End If

    End Sub

    --
    '---------------
    'John Mishefske
    '---------------

    Comment

    • Allen Browne

      #3
      Re: Disabling Function keys

      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" <armando@bogusa ddress.com> wrote in message
      news:LEIyd.1413 $925.150854@new s1.epix.net...[color=blue]
      > 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[/color]


      Comment

      • Armando

        #4
        Re: Disabling Function keys

        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


        Comment

        Working...