| hippiechic (2) | |||
|
I have subclassed an Edit control for the purpose of detecting the enter key being pressed then calling a function accordingly. All that part seems to work just fine so far. The problem I am having is that I then want the Edit control to not move to the next line. I have tried simply returning 0 after calling my procedure that should trigger on each press of the enter key, but this does not seem to prevent the Edit box from moving down to the next line. This is what I have thus far:
I have searched online and found some examples on how to disable Ctrl+V and Ctrl+Alt+Del and the like. These seem to be a bit advanced and outside the scope of something that to me must be much simpler. I also found examples on how to prevent normal roman characters and numbers from being sent, they suggested using return 0. This solution doesn't seem to work in regards to Enter though. | |||
|
|
|||
| modoran (1245) | |
|
Try to process WM_CHAR message, at least this is the approach I found on google. http://cboard.cprogramming.com/windows-programming/67604-capture-enter-key-press-edit-box.html If the only problem you have is moving the cursor next line, just save the text in a buffer and send it again to the edit control after pressing ENTER key using EM_REPLACESEL message: http://msdn.microsoft.com/en-us/library/windows/desktop/bb761633(v=vs.85).aspx | |
|
Last edited on
|
|
| guestgulkan (2915) | |||
|
I tried your code and it does do as you say - so I thought the edit box might still be recieving the WM_CHAR with carriage return - so I did this:
It seemed to do the trick for me. | |||
|
|
|||
| hippiechic (2) | |
| Thank you so much for figuring this out. I just got back to the computer after having become frustrated and having to walk away for a bit and find that you guys solved the problem. ^^ | |
|
|
|
| guestgulkan (2915) | |||
Mind you I jst thought - if we always recieve the WM_CHAR - we can ignore the WK_RETURN code and just use the WM_CHAR code - ike this:
| |||
|
|
|||