Hey I'm having a problem wondering if any of you guys know why.
I have an edit control where I validate it for proper text length but need it to set focus if the text entered is not valid.
I used the code below:
Code:
case FRAME_START + 47: // TABLE NAME
{
v = GetWindowTextLength((HWND)lParam);
if(v < 8 || v > 20){
MessageBox(0, "Table name must be 8 to 20 characters long.", "Invalid Table Name", 0);
SetWindowText((HWND)lParam, "");
SendMessage((HWND)lParam, WM_SETFOCUS, 0, 0);
}
break;
}
But whenever I use it, it will set focus to the text box but then the textbox cannot be typed in any longer. Really weird problem.
I sending the message EM_SETREADONLY w/ a false wParam but that didn't seem to be the problem. What's weird is I can right click in the text box and copy/cut/paste/delete text from it but can't add text by typing it after sending the WM_SETFOCUS message.
I have the textbox contained as a child within a subclassed static if that makes any difference. The case statement provided above is just a portion of the procedure I have for the subclassed container.
Edit: Actually what's really strange is I tried using the WM_SETFOCUS message on another edit control and it acts really strange. I'll click on that edit control click off and click on an entirely different control and type something then click off of it and if I click back onto the original edit control again it will set focus to the previous one before it. It's kindof hard to explain unless you saw the results for yourself.
Help is greatly appreciated. Thanks.