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: <1991Jun20.172036.6554@hyper.hyper.com>
Reply-To: bonneau@hyper.UUCP (Paul Bonneau,,)
Organization: HyperCube Inc.
References: <STERGIOS.91Jun18103411@kt22.Stanford.EDU> <1991Jun19.185843.2195@hyper.hyper.com> <1991Jun19.215304.13141@cbnewsj.att.com>
Distribution: na
Date: Thu, 20 Jun 1991 17:20:36 GMT

In article <1991Jun19.215304.13141@cbnewsj.att.com> lk@cbnewsj.att.com (lisa.a.krauth) writes:
>In article <1991Jun19.185843.2195@hyper.hyper.com>, bonneau@hyper.hyper.com (Paul Bonneau) writes:
>> 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.
>
>With version 2.1 of the SDK you did not need to press ctrl-enter to
>move to the next line.  The enter key would move you to the next line
>in the editbox.  Is this (ctrl-enter) something new in 3.0?  I have
>also been struggling with the MLE trying to get it to behave as it did
>with version 2.1 of the SDK.  Can anyone shed some more light on this
>subject?  Why has the behavior changed?
>
Sorry for the misunderstanding.  Even in win 3.0, a plain
simple <enter> will insert a new-line into the MLE.  The
problem is that the dialog manager will never let it happen.
As for <ctrl>-<enter>, it is not an implementation
restriction but rather what Microsoft's own windows apps do
(for example Edit Summary Info in W4W).

You can use just plain old <enter> if you want, if you are
willing to go through the hoops I described.  Also, I don't
think the behaviour *has* changed.  I seem to recall that
hitting <enter> in a win 2.x dialog would always activate
the Default PushButton, regardless of the keyboard focus.

cheers - Paul Bonneau.
