Dialog
-
Hi, Is there a way to prevent dialog from closing when pressing on "enter" keyboard button? Thanks Everything's beautiful if you look at it long enough...
If you are using MFC, see this FAQ: http://www.codeproject.com/cpp/cppforumfaq.asp#mfc\_dlgclosekeys
-
Hi, Is there a way to prevent dialog from closing when pressing on "enter" keyboard button? Thanks Everything's beautiful if you look at it long enough...
You could always override CDialog::OnOK() but that would also stop the OK button from making your dialog disappear. Adam. My world tour What I do now.. "I spent a lot of my money on booze, birds and fast cars. The rest I just squandered" George Best.
-
If you are using MFC, see this FAQ: http://www.codeproject.com/cpp/cppforumfaq.asp#mfc\_dlgclosekeys
http://www.codeproject.com/cpp/cppforumfaq.asp#mfc_dlgclosekeys[^] My world tour What I do now.. "I spent a lot of my money on booze, birds and fast cars. The rest I just squandered" George Best.
-
Hi, Is there a way to prevent dialog from closing when pressing on "enter" keyboard button? Thanks Everything's beautiful if you look at it long enough...
-
Also, don't forget to override
OnCancel()
if you don't want the dialog to disappear when the user presses Esc. /ravi Let's put "civil" back in "civilization" Home | Articles | Freeware | Music ravib@ravib.comHmm..kinda wondering how to stop the enter button but still enable the Ok button (okay, I guess I could hide the default OK button, create a new one that does all the stuff but I think it is cheating....) any thoughts? My world tour What I do now.. "I spent a lot of my money on booze, birds and fast cars. The rest I just squandered" George Best.
-
Hmm..kinda wondering how to stop the enter button but still enable the Ok button (okay, I guess I could hide the default OK button, create a new one that does all the stuff but I think it is cheating....) any thoughts? My world tour What I do now.. "I spent a lot of my money on booze, birds and fast cars. The rest I just squandered" George Best.
I just delete the default (not hide) OK button and create a new one. Alternatively, you could override
PreTranslateMsg()
and catch the Enter keystroke there. I prefer the former way. /ravi Let's put "civil" back in "civilization" Home | Articles | Freeware | Music ravib@ravib.com -
I just delete the default (not hide) OK button and create a new one. Alternatively, you could override
PreTranslateMsg()
and catch the Enter keystroke there. I prefer the former way. /ravi Let's put "civil" back in "civilization" Home | Articles | Freeware | Music ravib@ravib.comI was fiddling around with PreTranslateMessage to see if I could get it to work but I agree with you. The first way you mentioned is the way I have always done it and it still seems the simplest! thanks! Adam. My world tour What I do now.. "I spent a lot of my money on booze, birds and fast cars. The rest I just squandered" George Best.
-
Hi, Is there a way to prevent dialog from closing when pressing on "enter" keyboard button? Thanks Everything's beautiful if you look at it long enough...