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.
Unfortunately, activation email could not send to your email. Please try again.

In an MDI parent-child form scenario, how do I disable the shortCuts to the EditControl in the child form so that the parent form can preview them ?

 

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.NET] Protected Overrides Function ProcessCmdKey(ByRef msg As Message, ByVal keyData As Keys) As Boolean   const Integer WM_KEYDOWN = 0x100   const Integer WM_SYSKEYDOWN = 0x104     If (msg.Msg = WM_KEYDOWN) ||(msg.Msg = WM_SYSKEYDOWN) Then    Select Case keyData     Case Keys.F5      MessageBox.Show("F5 Captured by MDI Parent Form")      Exit Function       ' and any other key that needs to be captured    End Select   End If     Return MyBase.ProcessCmdKey( msg,keyData) End Function

Article ID: Published Date: Last Revised Date: Platform: Control:
302 04/30/2011 07/10/2014 Windows Forms EditControl
Tags:
Did you find this information helpful?
Add Comment
You must log in to leave a comment

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.