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 PLEASE HELP!!

arrow keys PLEASE HELP!!

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
2 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

    Why doesnt my program recive them the messages seem to go straigh to the toolbar i have tried to map OnKeyUp OnKeyDown OnChar all at once and non work here is the code im using for all 3 of them void DlgMapEdit::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags) { switch(nChar) { case VK_UP: curr_room.y -= 1; MessageBox("Key Up OnChar"); break; case VK_DOWN: curr_room.y += 1; break; case VK_LEFT: curr_room.x -= 1; break; case VK_RIGHT: curr_room.x += 1; break; } UpdateDisplay(); CDialog::OnChar(nChar, nRepCnt, nFlags); } the code for all 3 is relitivly the same but it doesnt even get to the message box so whats the deal is there something special i have to do? when i hit the arrow keys it moves around the selected button on the toolbar and i dont want that :P i also tried to use OnSysKeyUp OnSysKeyDown and OnSysKeyChar but none of them work it all goes to the toolbar SOMEONE PLEASE HELP!!!!! thanks

    N 1 Reply Last reply
    0
    • M Marissa182

      Why doesnt my program recive them the messages seem to go straigh to the toolbar i have tried to map OnKeyUp OnKeyDown OnChar all at once and non work here is the code im using for all 3 of them void DlgMapEdit::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags) { switch(nChar) { case VK_UP: curr_room.y -= 1; MessageBox("Key Up OnChar"); break; case VK_DOWN: curr_room.y += 1; break; case VK_LEFT: curr_room.x -= 1; break; case VK_RIGHT: curr_room.x += 1; break; } UpdateDisplay(); CDialog::OnChar(nChar, nRepCnt, nFlags); } the code for all 3 is relitivly the same but it doesnt even get to the message box so whats the deal is there something special i have to do? when i hit the arrow keys it moves around the selected button on the toolbar and i dont want that :P i also tried to use OnSysKeyUp OnSysKeyDown and OnSysKeyChar but none of them work it all goes to the toolbar SOMEONE PLEASE HELP!!!!! thanks

      N Offline
      N Offline
      Neville Franks
      wrote on last edited by
      #2

      Dialogs do there own keyboard handling, so you won't see keys like VK_UP. You'll need to get in before the normal dialog processing does. Try PreTranslateMessage() - not sure if that works with dialogs though. Hooking these keys in a dialog seems strange though. If you look below the editing window you will see a toolbar to format code etc. Please try and use that. Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com

      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