IContextMenu Interface
Declares context menu settings and methods.
Declaration
export interface IContextMenu
Properties
enabled Property
Specifies whether the context menu is enabled.
Declaration
enabled: boolean
Property Value
Type | Description |
---|---|
boolean | true, to enable the context menu; otherwise, false. |
Remarks
function onContextMenuShowing(s, e) {
var characterProperties = s.selection.activeSubDocument.getCharacterProperties(s.selection.intervals[0]);
if (characterProperties.strikeout==true ) {
e.contextMenu.enabled = false;
}
};
items Property
Provides access to the context menu item collection.
Declaration
items: ContextMenuItem[]
Property Value
Type | Description |
---|---|
ContextMenuItem[] | An array of items. |
Remarks
richEdit.contextMenu.removeItem(richEdit.contextMenu.items[10]);
The context menu contains the set of default commands. To customize it, use the following methods:
- insertItem(item);
- insertItemAfter(item, target);
- insertItemBefore(item, target);
- removeItem(item);
- removeItem(id).
Methods
getItem(id) Method
Returns a context menu item with the specified identifier.
Declaration
getItem(
id: CommandId | RibbonItemId
): ContextMenuItem | null
Parameters
Name | Type | Description |
---|---|---|
id | CommandId | RibbonItemId | An item identifier. |
Returns
Type | Description |
---|---|
ContextMenuItem | An item with the specified id property value. |
Remarks
richEdit.contextMenu.getItem(DevExpress.RichEdit.ContextMenuCommandId.Copy).text='Copy the text';
insertItem(item) Method
Inserts an item at the specified position.
Declaration
insertItem(
item: ContextMenuItem,
index?: number
): ContextMenuItem
Parameters
Name | Type | Description |
---|---|---|
item | ContextMenuItem | A context menu item to insert. |
index | number | The zero-based index at which the specified item should be inserted. |
Returns
Type | Description |
---|---|
ContextMenuItem | The item that was inserted. |
Remarks
richEdit.contextMenu.insertItem(
new DevExpress.RichEdit.ContextMenuItem(DevExpress.RichEdit.MailMergeTabCommandId.CreateDateField,
{ icon: 'clock', text: 'Insert Date Field', beginGroup: true}), 1);
When you do not specify the item position, the control inserts the item at the bottom of the context menu.
insertItemAfter(item, target) Method
Inserts an item after the target item.
Declaration
insertItemAfter(
item: ContextMenuItem,
target: ContextMenuItem | CommandId | RibbonItemId
): ContextMenuItem
Parameters
Name | Type | Description |
---|---|---|
item | ContextMenuItem | A context menu item to insert. |
target | ContextMenuItem | CommandId | RibbonItemId | The target item or its identifier. |
Returns
Type | Description |
---|---|
ContextMenuItem | The item that was inserted. |
Remarks
richEdit.contextMenu.insertItemAfter(
new DevExpress.RichEdit.ContextMenuItem(DevExpress.RichEdit.MailMergeTabCommandId.CreateDateField,
{ icon: 'clock', text: 'Insert Date Field', beginGroup: true}), DevExpress.RichEdit.HomeTabCommandId.Copy);
When the context menu does not contain the target item, the control inserts the item at the bottom of the context menu.
insertItemBefore(item, target) Method
Inserts an item before the target item.
Declaration
insertItemBefore(
item: ContextMenuItem,
target: ContextMenuItem | CommandId | RibbonItemId
): ContextMenuItem
Parameters
Name | Type | Description |
---|---|---|
item | ContextMenuItem | A context menu item to insert. |
target | ContextMenuItem | CommandId | RibbonItemId | The target item or its identifier. |
Returns
Type | Description |
---|---|
ContextMenuItem | The item that was inserted. |
Remarks
richEdit.contextMenu.insertItemBefore(
new DevExpress.RichEdit.ContextMenuItem(DevExpress.RichEdit.MailMergeTabCommandId.CreateDateField,
{ icon: 'clock', text: 'Insert Date Field', beginGroup: true}), DevExpress.RichEdit.HomeTabCommandId.Copy);
When the context menu does not contain the target item, the control inserts the item at the bottom of the context menu.
removeItem(id) Method
Removes an item with the specified identifier from the context menu.
Declaration
removeItem(
id: CommandId | RibbonItemId
): ContextMenuItem | null
Parameters
Name | Type | Description |
---|---|---|
id | CommandId | RibbonItemId | An item identifier. |
Returns
Type | Description |
---|---|
ContextMenuItem | The item that was removed. |
Remarks
richEdit.contextMenu.removeItem(DevExpress.RichEdit.HomeTabCommandId.Copy);
removeItem(item) Method
Removes an item from the context menu.
Declaration
removeItem(
item: ContextMenuItem
): ContextMenuItem | null
Parameters
Name | Type | Description |
---|---|---|
item | ContextMenuItem | A context menu item to remove. |
Returns
Type | Description |
---|---|
ContextMenuItem | The item that was removed. |
Remarks
richEdit.contextMenu.removeItem(richEdit.contextMenu.items[10]);