Diable enter key
-
I would like to know if there is a way to disable the enter key from being used in my app. It seems that every time the enter key is pressed, it closes a dialog in my app. Thank you. Jimmy Just cause I am 15, doesn't mean I'm dumb! (I'll really be 4 on Feb. 29...the year 2004)
-
I would like to know if there is a way to disable the enter key from being used in my app. It seems that every time the enter key is pressed, it closes a dialog in my app. Thank you. Jimmy Just cause I am 15, doesn't mean I'm dumb! (I'll really be 4 on Feb. 29...the year 2004)
There are basically 2 ways to handle this.
- Write a handler for OnOK() that doesn't do anything (i.e. just returns) and create another "OK" button (eg. with id
IDC_REAL_OK_BUTTON
) and write a handler for that, which simply callsCDialog::OnOK()
. - Override
PreTranslateMessage()
and filter out the appropriate message - I think it'sWM_CHAR
but I could be wrong. This will force your user to click the OK button to end the dialog.
/ravi Let's put "civil" back in "civilization" Home | Articles | Freeware | Music ravib@ravib.com
- Write a handler for OnOK() that doesn't do anything (i.e. just returns) and create another "OK" button (eg. with id
-
There are basically 2 ways to handle this.
- Write a handler for OnOK() that doesn't do anything (i.e. just returns) and create another "OK" button (eg. with id
IDC_REAL_OK_BUTTON
) and write a handler for that, which simply callsCDialog::OnOK()
. - Override
PreTranslateMessage()
and filter out the appropriate message - I think it'sWM_CHAR
but I could be wrong. This will force your user to click the OK button to end the dialog.
/ravi Let's put "civil" back in "civilization" Home | Articles | Freeware | Music ravib@ravib.com
Thanks Ravi, I am still new to Programming, and what you said makes sense but is still foreign to me. Can you tell me where I would find the PreTranslateMessage() function? Perhaps you would be kind enough to point me to some example code or some steps to which i can get this accomplished. Thanks you. Jimmy Just cause I am 15, doesn't mean I'm dumb! (I'll really be 4 on Feb. 29...the year 2004)
- Write a handler for OnOK() that doesn't do anything (i.e. just returns) and create another "OK" button (eg. with id
-
I would like to know if there is a way to disable the enter key from being used in my app. It seems that every time the enter key is pressed, it closes a dialog in my app. Thank you. Jimmy Just cause I am 15, doesn't mean I'm dumb! (I'll really be 4 on Feb. 29...the year 2004)
-
Thanks Ravi, I am still new to Programming, and what you said makes sense but is still foreign to me. Can you tell me where I would find the PreTranslateMessage() function? Perhaps you would be kind enough to point me to some example code or some steps to which i can get this accomplished. Thanks you. Jimmy Just cause I am 15, doesn't mean I'm dumb! (I'll really be 4 on Feb. 29...the year 2004)