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

Keyboard Shortcuts

What is the proper way to turn off the keyboard shortcuts. What is happenening is that I open an edit box, but the shortcuts on the current menu are still active, so if the user presses delete, not only does the text delete, but the menu choice for delete also fires.

1 Reply

AD Administrator Syncfusion Team April 22, 2005 04:40 PM

Hi Steve, Thanks for your feedback on this issue. This is a known shortcoming in the .NET framework and this is how the .NET MainMenu behaves too. To workaround this problem, handle the edit box (RichTextBox has been used in this sample) GotFocus and LostFocus events to set or reset the corresponding BarItem''s Shortcut. private void richTextBox1_GotFocus (object sender, EventArgs e) { this.barItem3.Shortcut = Shortcut.None; } private void richTextBox1_LostFocus (object sender, EventArgs e) { this.barItem3.Shortcut = Shortcut.Del; } The test sample attached here illustrates this workaround. As long as the RichTextBox has focus the Shortcut is disabled, and hence the delete key has the desired effect on the RichTextBox. If you tab out of the RichTextBox such that the Button has focus, Delete shortcut gets reassigned and pressing the Delete key will fire the Click event of the BarItem. Please refer to it and let me know if this works for you. Regards, Guru Patwal Syncfusion, Inc.

Loader.
Live Chat Icon For mobile
Up arrow icon