We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Menu Short Cut - Escape Key

Thread ID:

Created:

Updated:

Platform:

Replies:

5509 Jul 7,2003 08:59 AM UTC Jul 10,2003 08:58 AM UTC WinForms 5
loading
Tags: FAQ
Lextar
Asked On July 7, 2003 08:59 AM UTC

I've configured my record actions (New, Update, Save etc) to a menu and set short cut keys for them. Now I've been using Ctrl+N for new, Ctrl+U for Update... now for Cancel, it would be Ctrl-C but then that is the short cut key for Cut. I want to set it to Escape key for Cancel, but it is not in the short cut list within the Menu Editor. Is it possible to manually configure it I can detect when the Escape key is pressed without defining it in every text/object box??

Ramesh Praveen [Syncfusion]
Replied On July 9, 2003 07:58 AM UTC

One way is to override ProcessCmdKey in your Form and listen to the Esc key. This should get called where ever the focus is on the form. -Praveen

Lextar
Replied On July 9, 2003 09:50 AM UTC

Erm... how do you do that?

Ramesh Praveen [Syncfusion]
Replied On July 9, 2003 05:58 PM UTC

In your form: //C#: protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { if(keyData == Keys.Escape) { //Do something. return true; } return base.ProcessCmdKey(ref msg, keyData); } -Praveen

Lextar
Replied On July 10, 2003 07:27 AM UTC

Doh, I presume that the solution you've given is for C? I should have stated that I'm working with Visual Basic. Does it work with VB?

Ramesh Praveen [Syncfusion]
Replied On July 10, 2003 08:58 AM UTC

' VB.Net Protected Overrides Function ProcessCmdKey(ByRef msg As Message, ByVal keyData As Keys) As Boolean If keyData = Keys.Escape Then 'Do something. Return True End If Return MyBase.ProcessCmdKey( msg, keyData) End Function

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;