2uzhan.com
Advertisement
Now Place:2uzhan.com » How do I override the base class OnOK() in my dialog class?

How do I override the base class OnOK() in my dialog class?

Visual C++ Bugs & Fixes @ November 13, 1999   Views:0

1]. How do I override base class OnOk() in a dialog?
I mean i manually tried to do so..but it didnt work.
It still closes when I press Enter. I dont have an Enter button!

--------------Solutions-------------

When you press the Enter key it acts the same as if you had clicked the default button on your dialog. By default this will be the OK button.

If you look in the OnOK function in your dialog class implementation file you will notice that the last line is

CDialog::OnOK();

this is calling the OnOK function in the base class. It is here that the dialog is being closed. If you comment out this line in your dialog .cpp file your problem will go away.

Hope this helps.

Michael Martin
Pegasystems Australia
Email: [email protected]

Tags:
© 2018 2uzhan.com Contact