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
close icon

EditControl default context menus

I have deactivated the default Syncfusion context menu that appears when you right-click in the edit control. However, it's hot-keys still appear to work.

What is the proper method to deactivate the context menu (and use one of my own) and ALSO deactivate the default hot-keys so that those in my new context menu will function?

7 Replies

GR Golda Rebecal Syncfusion Team August 2, 2007 08:56 AM UTC

Hi Sam,

The shortcut keys for custom menu items has to be placed in a xml file and bound to the EditControl using the LoadBindingsFromXML method of the KeyBindingProcessor in order to make only the shortcut keys defined for the custom context menu to function.

Please refer to the attached sample that illustrates the same:
http://websamples.syncfusion.com/samples/Edit/F66531/main.htm

Kindly let me know if this meets your requirement.

We appreciate your interst in Syncfusion products.

Best regards,
Golda


SA Sam August 3, 2007 01:32 AM UTC

I may not have explained my goal clearly enough. I do not wish to add a custom menu item to the existing context menu. I wish to

1-deactivate the entire existing context menu.
2-add a *replacement* context menu (consisting of my menu items and their own hot-keys).

Can this be done without having to modify the existing context menu and *without* having to content with an xml file for hotkeys?


MF Meera Fathima Syncfusion Team August 7, 2007 11:02 AM UTC


Hello Sam,

Please find the below response on your queries.

1-deactivate the entire existing context menu.

You can disable the default context menu of the edit control by setting the EditControl.ContextMenuEnabled property to false value.

2-add a *replacement* context menu (consisting of my menu items and their own hot-keys).

You can use your context menu for the edit control by using the EditControl1.ContextMenu = ContextMenu (or editControl1.ContextMenuStrip = this.contextMenuStrip1).

Best Regards,
Meera.

Syncfusion, Inc.
http://www.syncfusion.com/


SA Sam August 9, 2007 02:42 AM UTC

Meera,
Disabling the default context menu of the edit control by setting the EditControl.ContextMenuEnabled property to false value *does* disable the context menu (as expected), but *does not* appear to disable any hot-keys associated with the default context menu (as would be expected).

Even after the context menu is deactivated in this fashion, using a hotkey (such as CTRL-P for PRINT) still causes a print dialog to appear.

I'm guessing that this is a bug...?


MF Meera Fathima Syncfusion Team August 10, 2007 12:01 PM UTC


Hello Sam,

Setting the EditControl.ContextMenuEnabled property to false value does disable the context menu and the hot keys that get activated are associated with the editcontrol itself. And so if you want to disable the hot keys such as Ctrl +P and etc., you need to remove the corresponding key binding using the EditControl.KeyBinder.RemoveBinding(..) method. Below is the sample code snippet for your reference.

this.editControl1.KeyBinder.RemoveBinding(Keys.Control | Keys.F);
this.editControl1.KeyBinder.RemoveBinding(Keys.Control | Keys.P);
this.editControl1.KeyBinder.RemoveBinding(Keys.Control | Keys.H);

Please try with the above details and let me know if you have any questions.

Best Regards,
Meera.

Syncfusion, Inc.
http://www.syncfusion.com/


SA Sam August 14, 2007 01:50 PM UTC

Meera,

Is there a method to remove *all* shortcut/key bindings? If not, is there a documented (or programmatic method) for getting a list of all bindings (so that they can be removed programmatically)?

Without knowing the complete list of what keys are currently bound by default in the edit control, there is no way of knowing which keys to remove until you discover that my hotkeys don't work, thereby indicating that there is an already bound hotkey.

Otherwise, the coder must manually remove every combination of keys possible--a rather daunting task to ondergo just to make sure that my hotkeys will all work in the future.

If not, I suggest that a "RemoveAllBindings" method be added.


AD Administrator Syncfusion Team December 31, 2007 09:54 AM UTC

Hi Sam,

Sorry for the delay in getting back to you.

Removing Key bindings

Please refer the below sample that illustrates how to embed a XML file in the project and load it from there to remove all the KeyBindings.

http://websamples.syncfusion.com/samples/Edit/F66531/RemoveBindings/main.htm

We have already logged a feature request regarding this to add a RemoveAll method. We will update you once we implemented this feature.

Please let me know if you require any more details.

Regards,
Jaya


Loader.
Live Chat Icon For mobile
Up arrow icon