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