)
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: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to disable the shortcuts to the WinForms SyntaxEditor (EditControl) in the child form so that the parent form can preview them?

Platform: WinForms |
Control: EditControl |
Published Date: April 30, 2011 |
Last Revised Date: December 15, 2019

Shortcut keys

This process involves the following steps.

1. Capture the EditControl's ContextMenu and remove the ShortCut key (for example F5) from the EditControl's ShortCuts, since this functionality will not be required anymore. For information on how to do this, please refer to the KB article – ‘How do I disable keyboard shortcuts for the EditControl?’ which may be accessed from this link :  http://www.syncfusion.com/Support/article.aspx?id=10334

2. Override the ProcessCmdKey() method in the MDI parent form to capture the F5 key. This ensures that F5 ShortCut is previewed only in the MDI parent form and not in the EditControl on the MDIChild form.

C#

protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
   const int WM_KEYDOWN = 0x100;   
   const int WM_SYSKEYDOWN = 0x104;
   if ((msg.Msg == WM_KEYDOWN) || (msg.Msg == WM_SYSKEYDOWN))
   {
       switch(keyData)
       {
           case Keys.F5:
                   MessageBox.Show("F5 Captured by MDI Parent Form");
           break;
    // and any other key that needs to be captured   
       }       
   }
   return base.ProcessCmdKey(ref msg,keyData);  
}

 

VB

Protected Overrides Function ProcessCmdKey(ByRef msg As Message, ByVal keyData As Keys) As Boolean
   Const WM_KEYDOWN As Integer = &H100
   Const WM_SYSKEYDOWN As Integer = &H104
   If (msg.Msg = WM_KEYDOWN) OrElse (msg.Msg = WM_SYSKEYDOWN) Then
       Select Case keyData
           Case Keys.F5
         MessageBox.Show("F5 Captured by MDI Parent Form")
                    ' and any other key that needs to be captured   
           End Select
   End If
   Return MyBase.ProcessCmdKey(msg,keyData)
End Function

Reference link: https://help.syncfusion.com/windowsforms/syntaxeditor/editing

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

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

Live Chat Icon For mobile
Live Chat Icon