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. Image for the cookie policy date

Menu Short Cut - Escape Key

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??

5 Replies

RP Ramesh Praveen Syncfusion Team 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

LE Lextar July 9, 2003 09:50 AM UTC

Erm... how do you do that?

RP Ramesh Praveen Syncfusion Team 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

LE Lextar 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?

RP Ramesh Praveen Syncfusion Team 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

Live Chat Icon For mobile
Up arrow icon