[comp.windows.ms] Help with EDITTEXT in modal dialog box

adrian@zap.sw.mcc.com (Adrian Lao) (08/02/90)

I got a problem with the EDITTEXT specified in the resource file.


I have a dialog box described in the resource file like this:

EditWindow DIALOG LOADONCALL MOVEABLE DISCARDABLE 10, 10, 265, 88
STYLE DS_MODALFRAME | WS_CAPTION
CAPTION "Edit Window"
BEGIN
	PUSHBUTTON 	"&Done", ID_DONE, 5, 8, 40,13
	PUSHBUTTON 	"&Check", ID_CHECK, 5, 8, 40,13
	PUSHBUTTON 	"&Reset", ID_RESET, 5, 8, 40,13
	PUSHBUTTON 	"C&ancel", ID_CANCEL, 5, 8, 40,13
	LTEXT		"Identity:", -1, 5, 30, 40, 12
	EDITTEXT   	ID_IDENTITY, 58, 28, 200, 12	
	LTEXT		"Declarations:", -1, 5, 47, 40, 12
	EDITTEXT	ID_DECLS, 58, 45, 200, 36, ES_MULTILINE | WS_VSCROLL |
			ES_AUTOVSCROLL
END

The dialog box pops up fine and everything works except the multline edit
control window.  According to the manual, if I specified ES_AUTOVSCROLL and
ES_MULTILINE, it should go to the next line in multiline edit window whenever
I press the "Enter" key, but not in this case, nothing happens when I press
the "Enter" key (of course, the focus is in the multi line edit control window).
The multi line edit control window just won't go to the next line.

So what happens?   

By the way, I'm using Window 3.0 SDK.

Adrian
adrian@sw.mcc.com

tremmel@iraul1.ira.uka.de (Wolfgang Tremmel) (08/02/90)

In article <4033@zap.sw.mcc.com> adrian@zap.sw.mcc.com (Adrian Lao) writes:
>
>The dialog box pops up fine and everything works except the multline edit
>control window.  According to the manual, if I specified ES_AUTOVSCROLL and
>ES_MULTILINE, it should go to the next line in multiline edit window whenever
>I press the "Enter" key, but not in this case, nothing happens when I press
>the "Enter" key (of course, the focus is in the multi line edit control window).

See the README (or TIPS) file: You have to use Control - Return. Enter is
reserved for the DefPushButton.

>The multi line edit control window just won't go to the next line.
>
>So what happens?   
>
Solution:
	- Define a STATIC control with an ID 1
	- Insert the following statements in the command - case:
	  case WM_COMMAND:
		.
		.
		.
		if (wParam == IDOK) {
			/* send a WM_CHAR message with 0x0a as wParam
			   to your edit - window */
			return(TRUE);
		}

btw, the edit - window works fine if it is not child of a dialog - box.
Has anybody a better solution?

Wolfgang Tremmel, tremmel@ira.uka.de