Article View: comp.windows.ms.programmer
Article #3308Re: Multiline Edit Control in Dialog
From: Paul Bonneau
Date: Wed, 19 Jun 1991 18:58
Date: Wed, 19 Jun 1991 18:58
46 lines
2372 bytes
2372 bytes
In article <STERGIOS.91Jun18103411@kt22.Stanford.EDU> 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. <return> 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 <ctrl>-<enter>. 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.
Technical Details
Message-ID:
<1991Jun19.185843.2195@hyper.hyper.com>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!watserv1!watmath!hyper.hyper.com!bonneauReferences:
<STERGIOS.91Jun18103411@kt22.Stanford.EDU>Show Full Headers
Complete Article Headers
Newsgroups: comp.windows.ms.programmer Path: arc1-ca.pugleaf.net!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: <STERGIOS.91Jun18103411@kt22.Stanford.EDU> Date: Wed, 19 Jun 1991 18:58:43 GMT