Results 1 to 6 of 6

Thread: keypressing

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jan 2000
    Location
    Leeds
    Posts
    30
    Hi there, this is a pretty simple problem i think being that i want to detect when an arrow key is pressed, but the system doesn't seem to register them as key presses.
    I have tried putting a function in the keypress function, to output the ascii code for the last keypress, but it doesn't register when an arrow is pressed, also what do VbKeyLeft/right/up/down denote?

    Thanks for any help, Piers


    The early bird gets the worm, but the second mouse gets the cheese.

  2. #2
    Hyperactive Member
    Join Date
    Jul 2002
    Location
    Canada
    Posts
    455
    Hello Piers,

    Try KeyDown

    Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
    MsgBox Str(KeyCode) & Str(Shift)
    End Sub


    Good luck,

    Michelle.

  3. #3
    Lively Member
    Join Date
    Dec 1999
    Posts
    106
    Use the keydown event
    up keycode = 38
    down keycode = 40
    right keycode = 39
    left keycode = 37


  4. #4

    Thread Starter
    Junior Member
    Join Date
    Jan 2000
    Location
    Leeds
    Posts
    30
    erm, it seems that neither of these work..
    i don't know why, but they just don't, ok the situation is that i'm using the flexgrid control and when a user moves around the grid with the arrow keys, i want to know about it..
    the keypress and keydown events don't even get triggered when i press the arrow keys, they only occur when i type anything else..

    Any other suggestions?

    Thanks Piers.
    The early bird gets the worm, but the second mouse gets the cheese.

  5. #5
    Addicted Member
    Join Date
    Aug 1999
    Location
    Ottawa,ON,Canada
    Posts
    217
    I just did a little testing and guess what. Your right, the Arrow Keys do not register in a FlexGrid. They don't even get intercepted by the Form if you set the KeyPreview property to True! But there is good news, there are two events that are triggered whenever a cell receives focus:
    SelChange and RowColChange
    (raised in that order)
    However, these are also called if the user clicks on a differnet cell, but this may be what you're looking for.

    Ciao for now.

  6. #6

    Thread Starter
    Junior Member
    Join Date
    Jan 2000
    Location
    Leeds
    Posts
    30
    Thanks for claifying that for me, i thought there my be something wrong with my machine , i've had a look at those two funcions you stated, and they look pretty useful to me, thanks.

    Piers
    The early bird gets the worm, but the second mouse gets the cheese.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width