Newsgroups: comp.windows.ms.programmer Path: utzoo!utgpu!watserv1!watmath!hyper.hyper.com!bonneau From: bonneau@hyper.hyper.com (Paul Bonneau) Subject: Re: Multiline Edit Control in Dialog Message-ID: <1991Jun19.185843.2195@hyper.hyper.com> Reply-To: bonneau@hyper.UUCP (Paul Bonneau,,) Organization: HyperCube Inc. References: Date: Wed, 19 Jun 1991 18:58:43 GMT In article stergios@kt22.Stanford.EDU writes: > > >Hi Gang, got a question/problem I hope you can help me with. > >SYNOPSIS: > Multiline edit control causes dialog box to go away when the >return key is pressed. > >DESCRIPTION: > I have a multiline edit crontrol in a dialog box. The flags >for the edit crontrol appearing in the resource are: > > ES_MULTILINE | WS _TABSTOP | WS_BORDER | WS_VISBLE | WS_CHILD > >Nothing fancy about that. I have tried adding ES_AUTOVSCROLL. The >multiline edit would then automatically scroll when it was time to >wordwrap, as one would expect, but still exhibit the same behaviour >when the return key was pressed. > >Could it be that a dialog default push button listens on the input >stream and accepts all returns no matter where the input focus is? > >Obviously, I do not completely understand dialogs. Can some clear >things up for me? > You're right. activates the default PushButton. It is interpreted by the dialog manager just after GetMessage(), and transformed into a button push (if there is a default PushButton). So the keyboard focus is not used. The translation is done by IsDialogMessage() (which is called internally for modal DialogBoxes). The standard way to enter a new-line into a MLE is to use -. If you wish to be nonstandard, you could make the dialog modeless and look for WM_KEYDOWN messages from GetMessage(). If you get one for a VK_RETURN, and the MLE of the dialog has the focus, *send* it a WM_CHAR of VK_RETURN and don't call IsDialogMessage(). If you want a modal dialog, just create a routine with a message pump that disables the owner window on entry and reenables on exit. It creates a modeless dialog, but as far as your app is concerned will behave modally. This is much easier than installing a WindowsHook of type WM_MSGFILTER. cheers - Paul Bonneau.