How to replace default keys behaivour in Edit control
-
I've a CEdit class. When you press 'a' from the keyboard, it writes 'a' in the control which is obvious. The problem is that I want to change this behaviour. when I press 'a' from the keyboard, some other character e.g. 'b' should be written. I have a 2D array that has mappings of all the keyboard keys. Actually I am dealing with Unicode (a multilingual application). Suppose I want to replace 'a' character with unicode 23456, which message should I handle. I have tried WM_KEYDOWN and WM_CHAR and changed the virtual key code. but it did not worked. In short, please tell me any way in which I can display 'b' in the edit control when 'a' is pressed. Saqib.
-
I've a CEdit class. When you press 'a' from the keyboard, it writes 'a' in the control which is obvious. The problem is that I want to change this behaviour. when I press 'a' from the keyboard, some other character e.g. 'b' should be written. I have a 2D array that has mappings of all the keyboard keys. Actually I am dealing with Unicode (a multilingual application). Suppose I want to replace 'a' character with unicode 23456, which message should I handle. I have tried WM_KEYDOWN and WM_CHAR and changed the virtual key code. but it did not worked. In short, please tell me any way in which I can display 'b' in the edit control when 'a' is pressed. Saqib.
-
Thanks alot for your help Greg. I got my problem solved. PreTranslateMessage function handed the whole MSG structure to me. I traped the WM_CHAR message and changed the wParam to 'b' when it was actually 'a'. if (pMsg->wParam == 'a') pMsg->wParam = 'b'; Codeproject is really amazing site. Thankyou once again. Saqib.
-
Thanks alot for your help Greg. I got my problem solved. PreTranslateMessage function handed the whole MSG structure to me. I traped the WM_CHAR message and changed the wParam to 'b' when it was actually 'a'. if (pMsg->wParam == 'a') pMsg->wParam = 'b'; Codeproject is really amazing site. Thankyou once again. Saqib.