How To Control the Context Menu in CuteEditor?
Cute Editor is a context sensitive application, it is aware of it's context and acts accordingly. Many functions of CuteEditor are accessible via the context menus (accessible through a right-click menu in the content area). This section describes how to control the context menu behavior in a Cute Editor control.
There are many ways to control the context menu behavior in a Cute Editor control:
1. |
Disable the default context menu. |
2. |
Disable the default context menu of the browser |
3. |
Load the different configuration file dynamically using Editor.ContextMenuMode property. |
4. |
Disable the context menu group by modifying the context menu configuration files.
|
5. |
Change the available context menu items and the order of the items by editing context menu definition file. |
6. |
Change the available context menu items and the order of the items by editing context menu definition file. |
1. Disable the Default Context Menu
To turn off context menus, you can choose one of the following methods:
1. Using the Editor.EnableContextMenu Property to specify whether the context menu is enabled.
2. Edit context menu configuration files .
All the context menu configuration files can be found in the cuteeditor_files/Configuration/ContextMenuMode folder. In the context menu configuration files, you can find the contextmenu element which contains the configuration information for the context menus within CuteEditor.
To turn off context menus, you need to disable all of the context menu groups.
Example:
- <?xml version="1.0" encoding="utf-8" ?>
- <configuration>
-
- <contextmenus>
- <ref name="Undo" />
- <spliter />
- <ref name="Cut" />
- <ref name="Copy" />
- <ref name="Paste" />
- <ref name="Delete" />
- <spliter />
- <ref name="SelectAll" />
- <ref name="EditGroup" />
- <ref name="FormattingGroup" />
- <ref name="InsertGroup" />
- <special type="tags"/>
- <special type="verbs"/>
- <special type="relative"/>
- <special type="style" />
- <special type="property" />
- </contextmenus>
- </configuration>
2. Disable the default context menu of the browser
To turn off context menus of the browser, you need to set Editor.EnableBrowserContextMenu Property to false.
Example:
- <%
- Dim editor
- Set editor = New CuteEditor
- editor.ID= "Editor1"
- editor.EnableContextMenu = "false"
- editor.EnableBrowserContextMenu = "false"
- editor.Text = "Hello World"
- editor.Draw()
- %>
3. Load the different configuration file dynamically using Editor.ContextMenuMode property.
Example:
- <%
- Dim editor
- Set editor = New CuteEditor
- editor.ID= "Editor1"
- editor.ContextMenuMode = "Simple"
- editor.Text = "Hello World"
- editor.Draw()
- %>
4. Disable the context menu group by modifying the context menu configuration files
For example, to disable edit group menu, you need to remove the following code:
5. Modify the context menu definition file.
The context menu definition file
(Common.config) can be found in the cuteeditor_files/Configuration/Shared folder. The
context menu definition influences the available context menu items and the
order of the context menu items. You can easily customize the context menu to
address your unique needs.
For example, to modify EditGroup menu, you need to change the following code:
<define name="EditGroup" text="[[Edit]]">
<subItems>
<ref name="Undo" />
<ref name="Redo" />
<spliter />
<ref name="SelectAll" />
<ref name="PasteText" />
<ref name="PasteWord" />
<spliter />
<ref name="ToggleBorder" />
<ref name="FromFullPage" />
<ref name="ToFullPage" />
</subItems>
<initializer>
<![CDATA[
]]>
</initializer>
</define>