Dialog Disappear on pressing Escape key
-
HI, On pressing Escape Key , my application dialog disappears .... Some one asked me to Override OnOk() and OnCancel() ...but there is no result ... Plz tell me a good one . thanx
-
HI, On pressing Escape Key , my application dialog disappears .... Some one asked me to Override OnOk() and OnCancel() ...but there is no result ... Plz tell me a good one . thanx
Did you remove the call to the CDialog implementation in
OnCancel
? -
HI, On pressing Escape Key , my application dialog disappears .... Some one asked me to Override OnOk() and OnCancel() ...but there is no result ... Plz tell me a good one . thanx
-
Did you remove the call to the CDialog implementation in
OnCancel
?i got it,, thanx ,, but wts a relation between Escape key and OnCancel() can u tell me littlte detail thanx
-
Did you remove the call to the CDialog implementation in
OnCancel
?Removing Oncancel .... escape key ok But Clsoe Button in System menu near maximize not works to close application another problm now any help abut it
-
HI, On pressing Escape Key , my application dialog disappears .... Some one asked me to Override OnOk() and OnCancel() ...but there is no result ... Plz tell me a good one . thanx
I normally use PreTranslateMessage to prevent unwanted key presses
BOOL CDialogClass::PreTranslateMessage(MSG* pMsg)
{
// Have we pressed a key
if (pMsg->message == WM_KEYDOWN)
{
// We only want to ignore the ESC
if (pMsg->wParam == VK_ESCAPE)
{
return TRUE;
}
}return CDialog::PreTranslateMessage(pMsg);
}Ant. I'm hard, yet soft.
I'm coloured, yet clear.
I'm fruity and sweet.
I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain) -
Removing Oncancel .... escape key ok But Clsoe Button in System menu near maximize not works to close application another problm now any help abut it
If you only want to filter the physical keyboard key, look at Anthonys answer below.
-
Removing Oncancel .... escape key ok But Clsoe Button in System menu near maximize not works to close application another problm now any help abut it
button work when you override OnCancel() you have to override OnClose(). In the override call CDialog::OnCancel(). The default behaviour of OnClose() is to call your overridden OnCancel() which you have told to do nothing. Do not override PreTranslateMessage(). That is just the lazyman's way of hacking things together.
[
](http://www.canucks.com)"You're obviously a superstar." - Christian Graus about me - 12 Feb '03 "Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04 Within you lies the power for good - Use it!