-
July 1st, 2006, 12:39 AM
#1
Issue with dialog
Hi all
I am making a dialog based application.
Now when we press "Esc" button then dialog is closed.
Now I want to stop this activity that is if press Esc button then dialog should not be closed.
Please help ( better if provide some code snippet for implementing this)
Thanks
-
July 1st, 2006, 01:07 AM
#2
Re: Issue with dialog
Originally Posted by hash123
Hi all
I am making a dialog based application.
Now when we press "Esc" button then dialog is closed.
Now I want to stop this activity that is if press Esc button then dialog should not be closed.
Please help ( better if provide some code snippet for implementing this)
Thanks
Code:
BOOL CDlg::PreTranslateMessage(MSG* pMsg)
{
BOOL handled; // indicates if message was handled
// assume that we didn't handle the message
handled = FALSE;
if (pMsg->wParam == VK_ESCAPE)
{
// prevent escape key from trickling
handled = TRUE;
}
// else let base class handle
else
{
handled = CDialog::PreTranslateMessage(pMsg);
}
return handled;
}
It takes seconds for rating…that actually compensates the minutes taken for giving answers
The biggest guru-mantra is: Never share your secrets with anybody. It will destroy you.
Regards, Be generous->Rate people
Jayender!!
-
July 1st, 2006, 03:46 AM
#3
Re: Issue with dialog
Take a look at this FAQ - it also explains that overriding PreTranslateMessage is not recommended in this situation.
Besides that: Dismissing a dialog with the Esc key is expected behaviour for dialogs - users will think something is wropng with your dialog if it doesn't behave that way. So I guess that your application probably shouldn't be a dialog, but a regualar application in the first place.
-
July 1st, 2006, 03:58 AM
#4
Re: Issue with dialog
Originally Posted by gstercken
Take a look at this FAQ - it also explains that overriding PreTranslateMessage is not recommended in this situation.
Besides that: Dismissing a dialog with the Esc key is expected behaviour for dialogs - users will think something is wropng with your dialog if it doesn't behave that way. So I guess that your application probably shouldn't be a dialog, but a regualar application in the first place.
If that is the case..
Override the OnCancel function for the dialog and Possible also to override OnOk and OnClose..
Ok .. Gstercken ?
Anyway thanks for the info ...
It takes seconds for rating…that actually compensates the minutes taken for giving answers
The biggest guru-mantra is: Never share your secrets with anybody. It will destroy you.
Regards, Be generous->Rate people
Jayender!!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|