Exit When Enter Key is Pressed
-
i'm a beginner in visual c++,i would like to know how can i prevent my application from Exiting when Enter Key is pressed at start-up.:confused:
Assuming your application is a dialog-based application, then pressing the enter key has the effect of pressing the default button, whichi by default is the OK button, which will cause your button to exit. If you don't want it to exit, either don't press enter, or change which button is the default one. If I'm way off then let us know a bit more about the nature of your application and I'm sure we can help :) Derek Lakin. Salamander Software Ltd.
-
i'm a beginner in visual c++,i would like to know how can i prevent my application from Exiting when Enter Key is pressed at start-up.:confused:
There is one another solution. You can override OnOK function. Simply add function: void CYourDialog::OnOK() { } And your problem disappearing...:-O :-O :rose: :rose: -------------------------------------------------- Say Whatever You Know. Helping other people is good for health. ========= Manish ========= ---------------------------------------------------
-
There is one another solution. You can override OnOK function. Simply add function: void CYourDialog::OnOK() { } And your problem disappearing...:-O :-O :rose: :rose: -------------------------------------------------- Say Whatever You Know. Helping other people is good for health. ========= Manish ========= ---------------------------------------------------
Why on earth would you leave the button there if you're not going to have it do anything ? You might check in OnOK if return has been pressed, so it works only by pressing the button, but it's just as easy not to make it the default button. Christian As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet. Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
-
Assuming your application is a dialog-based application, then pressing the enter key has the effect of pressing the default button, whichi by default is the OK button, which will cause your button to exit. If you don't want it to exit, either don't press enter, or change which button is the default one. If I'm way off then let us know a bit more about the nature of your application and I'm sure we can help :) Derek Lakin. Salamander Software Ltd.