termination of the dialog
-
hai, iam getting a small problem with dialogs.when ever a dialog is displayed and when ENTER or ESC key is pressed then the dialog is terminating.so plz help me to sort out this problem. sathish
-
hai, iam getting a small problem with dialogs.when ever a dialog is displayed and when ENTER or ESC key is pressed then the dialog is terminating.so plz help me to sort out this problem. sathish
-
hai, iam getting a small problem with dialogs.when ever a dialog is displayed and when ENTER or ESC key is pressed then the dialog is terminating.so plz help me to sort out this problem. sathish
You can override 2 function OnOK() (for ENTER) and OnCancel (for ESC). In override function, you don't call base function from class CDialog Example: void CMyDialog::OnOK() { //CDialog::OnOK(); } ----------------- conglt
-
hai, iam getting a small problem with dialogs.when ever a dialog is displayed and when ENTER or ESC key is pressed then the dialog is terminating.so plz help me to sort out this problem. sathish
-
hai, iam getting a small problem with dialogs.when ever a dialog is displayed and when ENTER or ESC key is pressed then the dialog is terminating.so plz help me to sort out this problem. sathish
The Esc key is automatically mapped to the IDCANCEL command. So you can get over that by overriding the handler to create an empty function. Your Enter key is probably calling the OnOK handler because your OK button has the default focus. Again you could override the IDOK handler and bypass the default action, but you should provide an alternative means of exiting yoru dialog (calling the CDialog::OnOk(), or EndDialog() functions), else your program will have no means of quitting.
I Dream of Absolute Zero
-
hai, iam getting a small problem with dialogs.when ever a dialog is displayed and when ENTER or ESC key is pressed then the dialog is terminating.so plz help me to sort out this problem. sathish
-
hai, iam getting a small problem with dialogs.when ever a dialog is displayed and when ENTER or ESC key is pressed then the dialog is terminating.so plz help me to sort out this problem. sathish
Hi mosali satish, maybe it is some helpful to you http://bobmoore.mvps.org/Win32/w32tip41.htm[^]
-
Hi mosali satish, maybe it is some helpful to you http://bobmoore.mvps.org/Win32/w32tip41.htm[^]
deal with the message "WM_KEYDOWN" in the function "PreTranslateMessage" like this: BOOL CYourDlg::PreTranslateMessage(MSG* pMsg) { // TODO: Add your specialized code here and/or call the base class if(pMsg->message == WM_KEYDOWN) { int nVitKey = (int)pMsg->wParam; if(nVitKey == VK_RETURN) return TRUE; else if(nVitKey == VK_ESCAPE) return TRUE; } return CDialog::PreTranslateMessage(pMsg); } than when you press the "enter"and"ESC" the dialog will not terminate. bambooshan
-
hai, iam getting a small problem with dialogs.when ever a dialog is displayed and when ENTER or ESC key is pressed then the dialog is terminating.so plz help me to sort out this problem. sathish
See here.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
-
deal with the message "WM_KEYDOWN" in the function "PreTranslateMessage" like this: BOOL CYourDlg::PreTranslateMessage(MSG* pMsg) { // TODO: Add your specialized code here and/or call the base class if(pMsg->message == WM_KEYDOWN) { int nVitKey = (int)pMsg->wParam; if(nVitKey == VK_RETURN) return TRUE; else if(nVitKey == VK_ESCAPE) return TRUE; } return CDialog::PreTranslateMessage(pMsg); } than when you press the "enter"and"ESC" the dialog will not terminate. bambooshan
Hi bambooshan, Is this my answer?or mosali satish