Escape Key
-
I have two dialogs.In first Dialog i have a one button.When i click that button the next dialog will appear .After that i have pressed the Escape key the both dialog is closed.I want to close only the child dialog. How to do this.plz help me?
-
I have two dialogs.In first Dialog i have a one button.When i click that button the next dialog will appear .After that i have pressed the Escape key the both dialog is closed.I want to close only the child dialog. How to do this.plz help me?
I have two questions:1: r ur dialog boxes modal? 2: how long time did u keep pressing on the ESC key?
life is like a box of chocolate,you never know what you r going to get.
-
I have two questions:1: r ur dialog boxes modal? 2: how long time did u keep pressing on the ESC key?
life is like a box of chocolate,you never know what you r going to get.
-
I have two questions:1: r ur dialog boxes modal? 2: how long time did u keep pressing on the ESC key?
life is like a box of chocolate,you never know what you r going to get.
-
prathuraj wrote:
how to find model and modeless dialog
If you used DoModel() API, for the child dialog to show it, then the child dialog is model.Instead if you used other API to show the dialog,say, ShowWindow(..),then its modeless
Do your Duty and Don't expect the Result
Rate this Post, if I helped You -
prathuraj wrote:
how to find model and modeless dialog
If you used DoModel() API, for the child dialog to show it, then the child dialog is model.Instead if you used other API to show the dialog,say, ShowWindow(..),then its modeless
Do your Duty and Don't expect the Result
Rate this Post, if I helped You -
I have two dialogs.In first Dialog i have a one button.When i click that button the next dialog will appear .After that i have pressed the Escape key the both dialog is closed.I want to close only the child dialog. How to do this.plz help me?
By default, the escape key triggers the OnCancel() event of a modal dialog. You must override the OnCancel function in your dialog class. Example from MSDN:
void MyDialog::OnCancel() { // TODO: Add extra cleanup here // Ensure that you reset all the values back to the // ones before modification. This handler is called // when the user doesn't want to save the changes. if ( AfxMessageBox("Are you sure you want to abort the changes?", MB_YESNO) == IDNO ) return; // Give the user a chance if he has unknowingly hit the // Cancel button. If he says No, return. Don't reset. If // Yes, go ahead and reset the values and close the dialog. CDialog::OnCancel(); }
-
By default, the escape key triggers the OnCancel() event of a modal dialog. You must override the OnCancel function in your dialog class. Example from MSDN:
void MyDialog::OnCancel() { // TODO: Add extra cleanup here // Ensure that you reset all the values back to the // ones before modification. This handler is called // when the user doesn't want to save the changes. if ( AfxMessageBox("Are you sure you want to abort the changes?", MB_YESNO) == IDNO ) return; // Give the user a chance if he has unknowingly hit the // Cancel button. If he says No, return. Don't reset. If // Yes, go ahead and reset the values and close the dialog. CDialog::OnCancel(); }
OnCancel is not only called by hitting ESC key, also called by closing dialog box, for settling this, I think u may overwrite CDialog::PreTranslateMessage funcion like this. BOOL CdlgtestDlg::PreTranslateMessage(MSG* pMsg) { if(pMsg->hwnd == m_hWnd || ::IsChild(m_hWnd,pMsg->hwnd) && (pMsg->message == WM_KEYDOWN || pMsg->message == WM_KEYUP)) { if(pMsg->wParam == VK_ESCAPE) return TRUE; } return CDialog::PreTranslateMessage(pMsg); }
life is like a box of chocolate,you never know what you r going to get.