cm = uicontextmenu()
cm = uicontextmenu(parent)
cm = uicontextmenu(propertyName, propertyValue, ...)
cm = uicontextmenu(parent, propertyName, propertyValue, ...)
| Parameter | Description |
|---|---|
| parent | Figure graphics object. When omitted, the current figure is used. |
| propertyName | Property name: a scalar string or row vector character. |
| propertyValue | Property value compatible with the property name. |
| Parameter | Description |
|---|---|
| cm | Context menu graphics object. |
uicontextmenu creates a context menu that can be assigned to the ContextMenu property of figures, axes, controls, and other graphics objects.
Menu items are created with uimenu using the context menu as parent.
See uicontextmenu properties for the complete property list.
f = figure();
ax = axes('Parent', f);
cm = uicontextmenu(f);
uimenu(cm, 'Text', 'Reset view', 'MenuSelectedFcn', 'disp(''reset'')');
ax.ContextMenu = cm;