The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: mariø on March 10, 2005, 09:30:09 AM

Title: Detect <ENTER> in dialog EDIT control
Post by: mariø on March 10, 2005, 09:30:09 AM
What is the message I have to proccess in DialogProc to detect an <ENTER> in a EDIT control?

Title: Re: Detect <ENTER> in dialog EDIT control
Post by: petezl on March 10, 2005, 10:30:54 AM
VK_RETURN will trap the enter key but if the edit control has focus and the ES_MULTILINE style then you don't need it, The enter key will create a new line.
Peter.
Title: Re: Detect <ENTER> in dialog EDIT control
Post by: mariø on March 10, 2005, 12:40:09 PM
I need to do something when the user press <enter> in a single line EDIT control.
I haven't receive VK_RETURN messages in the dialog proc (note that I use the dialog as a main window, created with:
Invoke DialogBoxParam, eax, IDD_SMS, NULL, Addr DialogProc, NULL )
Title: Re: Detect <ENTER> in dialog EDIT control
Post by: petezl on March 10, 2005, 01:54:23 PM
If focus was on say a button in a dialog proc then enter would be the equivalent of pushing it. If the focus was on a single line edit control (without actually testing it) I should imagine that nothing would happen!
You could trap the enter Key with something like:
.elseif uMsg==WM_KEYDOWN
mov eax, wParam
.if eax==VK_RETURN
invoke SendMessage, do something

But that would probably mess with the tab system that is controlled by windows in a dialog proc.
You might have to find out first whether the focus is set to that particular edit control.

Peter.
Title: Re: Detect <ENTER> in dialog EDIT control
Post by: AeroASM on March 10, 2005, 02:08:50 PM
I think you have to subclass it; look up Iczelion's tutorial.
Title: Re: Detect <ENTER> in dialog EDIT control
Post by: mariø on March 10, 2005, 02:20:37 PM
Quote from: AeroASM on March 10, 2005, 02:08:50 PM
I think you have to subclass it; look up Iczelion's tutorial.

thanks AeroASM, Tutorial 22: Superclassing is where I need