| MATLAB Function Reference | ![]() |
You can set and query graphics object properties in two ways:
inspect function at the command line.
set and get functions enable you to set and query the values of properties.
For more information about changing the default value of a property see Setting Default Property Values. For an example, see the CreateFcn property.
UicontextmenuProperties
This section lists all properties useful to uicontextmenu objects along with valid values and descriptions of their use. Curly braces {} enclose default values.
| Property |
Purpose |
BusyAction |
Callback routine interruption |
Callback |
Control action |
Children |
The uimenus defined for the uicontextmenu |
CreateFcn |
Callback routine executed during object creation |
DeleteFcn |
Callback routine executed during object deletion |
HandleVisibility |
Whether handle is accessible from command line and GUIs |
Interruptible |
Callback routine interruption mode |
Parent |
Uicontextmenu object's parent |
Position |
Location of uicontextmenu when Visible is set to on |
Tag |
User-specified object identifier |
Type |
Class of graphics object |
UserData |
User-specified data |
Visible |
Uicontextmenu visibility |
BusyAction cancel | {queue}
Callback routine interruption. If a callback is executing and the user triggers an event (such as a mouse click) on an object for which a callback is defined, the callback associated with the new event uses the value of BusyAction to decide whether or not to attempt to interrupt the executing callback.
cancel, the event is discarded and the second callback does not execute.
queue, and the Interruptible property of the first callback is on, the second callback is added to the event queue and executes in its turn after the first callback finishes execution.
Note
If the interrupting callback is a DeleteFcn or CreateFcn callback or a figure's CloseRequest or ResizeFcn callback, it interrupts an executing callback regardless of the value of that object's Interruptible property. See the Interruptible property for information about controlling a callback's interruptibility.
|
ButtonDownFcn string
This property has no effect on uicontextmenu objects.
Callback string
Control action. A routine that executes whenever you right-click an object for which a context menu is defined. The routine executes immediately before the context menu is posted. Define this routine as a string that is a valid MATLAB expression or the name of an M-file. The expression executes in the MATLAB workspace.
Children matrix
The uimenus defined for the uicontextmenu.
Clipping {on} | off
This property has no effect on uicontextmenu objects.
CreateFcn string
Callback routine executed during object creation. The specified function executes when MATLAB creates a uicontextmenu object. MATLAB sets all property values for the uicontextmenu before executing the CreateFcn callback so these values are available to the callback. Within the function, use gcbo to get the handle of the uicontextmenu being created.
Setting this property on an existing uicontextmenu object has no effect.
You can define a default CreateFcn callback for all new uicontextmenus. This default applies unless you override it by specifying a different CreateFcn callback when you call uicontextmenu. For example, the code
creates a default CreateFcn callback that runs whenever you create a new context menu. It sets the default Visible property of a context menu.
To override this default and create a context menu whose Visible property is set to a different value, call uicontextmenu with code similar to
See Function Handle Callbacks for information on how to use function handles to define a callback function.
DeleteFcn string
Delete uicontextmenu callback routine. A callback routine that executes when you delete the uicontextmenu object (e.g., when you issue a delete command or clear the figure containing the uicontextmenu). MATLAB executes the routine before destroying the object's properties so these values are available to the callback routine.
The handle of the object whose DeleteFcn is being executed is accessible only through the root CallbackObject property, which you can query using gcbo.
See Function Handle Callbacks for information on how to use function handles to define a callback function.
HandleVisibility {on} | callback | off
Control access to object's handle. This property determines when an object's handle is visible in its parent's list of children. When a handle is not visible in its parent's list of children, it is not returned by functions that obtain handles by searching the object hierarchy or querying handle properties. This includes get, findobj, gca, gcf, gco, newplot, cla, clf, and close. Neither is the handle visible in the parent figure's CurrentObject property. Handles that are hidden are still valid. If you know an object's handle, you can set and get its properties, and pass it to any function that operates on handles.
HandleVisibility is on.
HandleVisibility to callback causes handles to be visible from within callback routines or functions invoked by callback routines, but not from within functions invoked from the command line. This provides a means to protect GUIs from command-line users, while allowing callback routines to have complete access to object handles.
HandleVisibility to off makes handles invisible at all times. This may be necessary when a callback routine invokes a function that might potentially damage the GUI (such as evaluating a user-typed string), and so temporarily hides its own handles during the execution of that function.
You can set the root ShowHiddenHandles property to on to make all handles visible, regardless of their HandleVisibility settings. This does not affect the values of the HandleVisibility properties.
HitTest {on} | off
This property has no effect on uicontextmenu objects.
Interruptible {on} | off
Callback routine interruption mode. If a callback is executing and the user triggers an event (such as a mouse click) on an object for which a callback is defined, that callback attempts to interrupt the first callback. MATLAB processes the callbacks according to these factors:
Interruptible property of the object whose callback is executing
drawnow, figure, getframe, pause, or waitfor statements
BusyAction property of the object whose callback is waiting to execute
If the Interruptible property of the object whose callback is executing is on (the default), the callback can be interrupted. Whenever the callback calls one of the drawnow, figure, getframe, pause, or waitfor functions, the function processes any events in the event queue, including the waiting callback, before performing its defined task.
If the Interruptible property of the object whose callback is executing is off, the callback cannot be interrupted (except by certain callbacks; see the note below). The BusyAction property of the object whose callback is waiting to execute determines what happens to the callback.
Parent handle
Uicontextmenu's parent. The handle of the uicontextmenu's parent object. You can move a uicontextmenu object to another figure, uipanel, or uibuttongroup by setting this property to the handle of the new parent.
Position vector
Uicontextmenu's position. A two-element vector that defines the location of a context menu posted by setting the Visible property value to on. Specify Position as
where vector elements represent the horizontal and vertical distances in pixels from the bottom left corner of the figure window, panel, or button group to the top left corner of the context menu.
Selected on | {off}
This property has no effect on uicontextmenu objects.
SelectionHighlight {on} | off
This property has no effect on uicontextmenu objects.
Tag string
User-specified object label. The Tag property provides a means to identify graphics objects with a user-specified label. This is particularly useful when constructing interactive graphics programs that would otherwise need to define object handles as global variables or pass them as arguments between callback routines. You can define Tag as any string.
Type string
Class of graphics object. For uicontextmenu objects, Type is always the string 'uicontextmenu'.
UIContextMenu handle
This property has no effect on uicontextmenus.
UserData matrix
User-specified data. Any data you want to associate with the uicontextmenu object. MATLAB does not use this data, but you can access it using set and get.
Visible on | {off}
Uicontextmenu visibility. The Visible property can be used in two ways:
on; when the context menu is not posted, its value is off.
on to force the posting of the context menu. Similarly, setting the value to off forces the context menu to be removed. When used in this way, the Position property determines the location of the posted context menu.
| uicontextmenu | uicontrol | ![]() |
© 1994-2005 The MathWorks, Inc.