Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Arrow keys

Arrow keys

Scheduled Pinned Locked Moved C / C++ / MFC
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Marissa182
    wrote on last edited by
    #1

    im wondering how i map these i tried OnChar and OnKeyUp and OnKeyDown but non of them do what i tell them to do instead it just moved the selected button on the tool bar i have here is the code i have for all 3 messages switch(nChar) { case VK_UP: curr_room.y -= 1; break; case VK_DOWN: case VK_LEFT: case VK_RIGHT: break; } as you can see its imcomplete the but VK_UP doesnt even work how i want it can someone tell me the proper way to get these keys to do work for me thanks

    K 1 Reply Last reply
    0
    • M Marissa182

      im wondering how i map these i tried OnChar and OnKeyUp and OnKeyDown but non of them do what i tell them to do instead it just moved the selected button on the tool bar i have here is the code i have for all 3 messages switch(nChar) { case VK_UP: curr_room.y -= 1; break; case VK_DOWN: case VK_LEFT: case VK_RIGHT: break; } as you can see its imcomplete the but VK_UP doesnt even work how i want it can someone tell me the proper way to get these keys to do work for me thanks

      K Offline
      K Offline
      KaRl
      wrote on last edited by
      #2

      I'm not sure to understand, could you specify these point? * What do you want to do? * In which class are you trying to catch the key input? * Do you call the base class after catching the messages?


      Every gun that is made, every warship launched, every rocket fired, signifies in the final sense a theft from those who hunger and are not fed, those who are cold and are not clothed - Dwight D. Eisenhower

      M 1 Reply Last reply
      0
      • K KaRl

        I'm not sure to understand, could you specify these point? * What do you want to do? * In which class are you trying to catch the key input? * Do you call the base class after catching the messages?


        Every gun that is made, every warship launched, every rocket fired, signifies in the final sense a theft from those who hunger and are not fed, those who are cold and are not clothed - Dwight D. Eisenhower

        M Offline
        M Offline
        Marissa182
        wrote on last edited by
        #3

        i have a grid of images and only one can be selected so i want to move the selection box around with the arrow keys im catching the key input in the main dialog i tried both ways and neither worked thanks

        K 1 Reply Last reply
        0
        • M Marissa182

          i have a grid of images and only one can be selected so i want to move the selection box around with the arrow keys im catching the key input in the main dialog i tried both ways and neither worked thanks

          K Offline
          K Offline
          KaRl
          wrote on last edited by
          #4

          Have you tried to override PreTranslateMessage?

          BOOL CMyDialog::PreTranslateMessage(MSG *pMSG)
          {
          if(pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_UP){
          // Do some stuff
          return TRUE;
          }
          return CDialog::PreTranslateMessage(pMSG);
          }


          Every gun that is made, every warship launched, every rocket fired, signifies in the final sense a theft from those who hunger and are not fed, those who are cold and are not clothed - Dwight D. Eisenhower

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups