Click to See Complete Forum and Search --> : Return key press in Dialogs


David Giovannini
June 3rd, 1999, 04:25 PM
Hello,
I am having just the opposite problem as "Dialog Focus Blues." Two dialogs in my application have desired behaviors switched and I do not know why.

The first is a login dialog. It has default styled button, a list box (users) and a password field. I would like the return key to simulate a click in the default button.

The second is a setup dialog. This dialog contains sub-CDialogs. The return key dismisses the parent dialog unless the control style is set true on the sub-dialogs and I have not switched which sub-dialog is visible.

Both dialogs have identical style attributes.

I believe ::IsDialogMessage is trapping and altering the return key message in the one dialog. What piece of logic do I not understand?

Thank you
Dave Giovannini

ric
June 4th, 1999, 06:02 AM
For the first case override the OnOK() fucntion like this:

void CMyDialog::OnOK()
{
OnClickedDefaultButton();
}

For the second:

I do not understand very well the problem.

David Giovannini
June 4th, 1999, 12:46 PM
I found that the following conditions needed to be met for the return/esc keys to work in my login dlg.

The buttons must have IDs IDOK and IDCANCEL. The IDOK button cannot be remapped to another method. This is probably why OnOK is virtual.

As far as the other problem. The odd thing is there is no default button an ony of the dialogs. I guess I can just override OnOK and have do nothing.