| | | 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 hpt = uicontextmenu(...,'CreateFcn','set(gcbo,... ,,Visible,,,,,off,,),) | | |
| | | Note To override a default CreateFcn callback you must provide a new callback and not just provide different values for the specified properties. This is because the CreateFcn callback runs after the property values are set, and can override property values you have set explicitly in the uicontextmenu call. In the example above, if instead of redefining the CreateFcn property for this uicontextmenu, you had explicitly set Visible to off, the default CreateFcn callback would have set Visible back to the default, i.e., on. | | |
| | | See "Function Handle Callbacks" for information on how to use function handles to define a callback function. DeleteFcn string or function handle 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. | | |