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

Modeless Dialog Question

0 views
Skip to first unread message

Mark Roberts

unread,
Mar 31, 2001, 12:33:21 PM3/31/01
to
Greetings:

I've created a modeless dialog with a simple edit box in it. I want the
user to be able to enter text through the edit box. I have found that if
the user presses the ENTER key while in the edit box, the message to
CLOSE the dialog gets issued. I don't want this. Ideally, if the user
presses ENTER after typing text in the edit box, I would like it to
accept the text typed, as if the "Apply" button had been clicked, but I
do not want it to close the dialog - only the CLOSE button gets to do
that.

Thank you in advance,
Mark Roberts
Toronto, Canada


Ramunas

unread,
Apr 1, 2001, 4:30:57 AM4/1/01
to
Thats because your CLOSE button's DEFAULT property is set to TRUE

"Mark Roberts" <mcro...@sympatico.ca> wrote in message
news:3AC614D4...@sympatico.ca...

Massimo Colurcio

unread,
Apr 1, 2001, 6:01:55 AM4/1/01
to
With ClassWizard (are you using VC++ ?) create the method associated
with the message ON_CLICK of OK button.
CW will create this kind of code:

void CYourDialog::OnOK()
{
// TODO: Add extra validation here

CDialog::OnOK();
}

To solve your problem, do this:

void CYourDialog::OnOK()
{
// TODO: Add extra validation here

// CDialog::OnOK(); <<<<<<---- look at this line!!!!!
}

That's all!

HTH,
Massimo.

On Sat, 31 Mar 2001 17:33:21 GMT, Mark Roberts
<mcro...@sympatico.ca> wrote:

>I've created a modeless dialog with a simple edit box in it. I want the
>user to be able to enter text through the edit box. I have found that if
>the user presses the ENTER key while in the edit box, the message to
>CLOSE the dialog gets issued. I don't want this. Ideally, if the user
>presses ENTER after typing text in the edit box, I would like it to
>accept the text typed, as if the "Apply" button had been clicked, but I
>do not want it to close the dialog - only the CLOSE button gets to do
>that.

mailto:m.col...@softhor.com
http://www.softhor.com/developmentarea
ICQ# 96413649

/**************************************************

"I've... seen things you people wouldn't believe.
Attack ships on fire off the shoulder of Orion.
I watched C-beams... glitter in the dark near the
Tanhauser Gate.
All those... moments will be lost... in time...,
like... tears... in... rain."

Blade Runner.

**************************************************/

0 new messages