|
-
April 18th, 2008, 02:18 PM
#1
how to detect changes in text in a textfield
In C++, plain win32 programming (NO MFC) what message is sent to the textfield's callback if the textfield's text changes? Basically, i need to know how to detect changes in the text of a textfield. Please help.
-
April 18th, 2008, 02:40 PM
#2
Re: how to detect changes in text in a textfield
If by textfield you mean an edit control, you want to handle the EN_CHANGE message.
-
April 18th, 2008, 03:13 PM
#3
Re: how to detect changes in text in a textfield
Yes i meant an edit control, however the en_change message seems to be evoked only if i cut text from the edit control and not if i type inside the edit control during runtime.Any other suggestions?
-
April 18th, 2008, 03:30 PM
#4
Re: how to detect changes in text in a textfield
 Originally Posted by blastingblast
Yes i meant an edit control, however the en_change message seems to be evoked only if i cut text from the edit control and not if i type inside the edit control during runtime.Any other suggestions?
Wrong! you should notificaiton also during text writing.
Cheers
-
April 19th, 2008, 01:24 AM
#5
Re: how to detect changes in text in a textfield
No its still not working for me. This is my callback function for the edit control.What am i doing wrong? Is the en_change given to the parent or something? Here is the callback.
LRESULT CALLBACK NewProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg)
{
case WM_LBUTTONDBLCLK:
....
break;
case EN_CHANGE:
MessageBox(0,L"text has changed",L"text has changed",0);
break;
case WM_KEYUP:
....
break;
case WM_MOUSEMOVE:
........
break;
}
return CallWindowProc(OldProc ,hwnd,msg,wParam,lParam);
}
please mention if there is any way to capture changes in text through the edit controls callback
-
April 20th, 2008, 04:26 PM
#6
Re: how to detect changes in text in a textfield
Code:
case WM_COMMAND:
switch (LOWORD(wParam))
{
case IDC_EDIT1: //Edit ID
{
if (HIWORD(wParam) == EN_CHANGE)
::MessageBox(0, "EN_CHANGE", "IDC_EDIT1", MB_OK);
break;
}
}
break;
Cheers
-
April 20th, 2008, 04:49 PM
#7
Re: how to detect changes in text in a textfield
blastingblast, notice that the snippet golanshahar gave you show you an important detail about window messages.
It's not a coincidence that they start with something like WM_, EN_, SC_ and so on. The first letters of the symbol indicate what group it belong to i.e. whenever you see a message that not start with WM_ you can be sure it's not handled directly in the message switch and that you have to read more about it on MSDN...
-
April 21st, 2008, 03:14 AM
#8
Re: how to detect changes in text in a textfield
Yeah i finally got it. Thanks guys. I made 2 mistakes
1) tried to check en_change in edit control's callback and not the form's
2) tried checking en_change in the message rather than in the wparam
Though this is all i need, if there is a way to detect changes in the edit control's callback instead of the form's,let me know.
Thanks for all the help.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|