Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

CEdit and enter key

30 views
Skip to first unread message

Drew C. Schleit

unread,
Jul 22, 2000, 3:00:00 AM7/22/00
to
The default behavior for pressing the Enter key in an edit box in a dialog
box is to submit the dialog box using IDOK. How do I change this so I can
make the Enter key do something else? Thanks.

Dave Smith

unread,
Jul 22, 2000, 3:00:00 AM7/22/00
to

First, make certain that your "OK" button does *NOT* have the
BS_DEFPUSHBUTTON style set. This style makes pressing enter the same as
clicking on this button. In fact, make certain that none of your pushbuttons
have this style.

Then, if your edit box is a multi-line edit control, set the ES_WANTRETURN
style on it.

Dave Smith
MCSE, MCT, MVP

"Drew C. Schleit" <asch...@hotmail.NOSPAM.com> wrote in message
news:YI8e5.1250$Z5.5...@typhoon1.ba-dsg.net...

장재훈

unread,
Jul 22, 2000, 3:00:00 AM7/22/00
to
In Derived class from CEdit, pretranslate the keydown message and do
something else....

Kee

unread,
Jul 22, 2000, 3:00:00 AM7/22/00
to
if you want the enter key to move from the edit box to next control (another
edit box below it), you can change(derive) the box to accept enter key to
work as 'tab' (make sure to set the correct tab order)

--
Kee Dae Nam
kn...@home.com

Knowledge is power -- Francis Bacon

David Wilkinson

unread,
Jul 22, 2000, 3:00:00 AM7/22/00
to
Kee:

And a fourth answer ...

Override PreTranslateMessage() in the dialog and look for WM_KEYDOWN and
VK_RETURN. Return TRUE and do not call the base class.

Personally, I like this way the best. No extra derived classes, and no
"trickery" with the buttons.

HTH,

David Wilkinson

===============

0 new messages