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 09:40 PM UTC

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.
Up arrow icon