MATLAB Function Reference (Volume 2: Graphics)

MATLAB Function Reference (Volume 2: Graphics) MATLAB Function Reference (Volume 2: Graphics)

12.07.2015 Views

uicontextmenuProperty Name Property Description Property ValueControlling Callback Routine ExecutionBusyAction Callback routine interruption Value: cancel, queueDefault: queueCallback Control action Value: stringCreateFcnDeleteFcnCallback routine executed duringobject creationCallback routine executed duringobject deletionValue: stringValue: stringInterruptible Callback routine interruption mode Value: on, offDefault: onControlling Access to ObjectsHandleVisibilityWhether handle is accessible fromcommand line and GUIsValue: on, callback, offDefault: onExampleThese statements define a context menu associated with a line. When the userextend-clicks anywhere on the line, the menu appears. Menu items enable theuser to change the line style.% Define the context menucmenu = uicontextmenu;% Define the line and associate it with the context menuhline = plot(1:10, 'UIContextMenu', cmenu);% Define callbacks for context menu itemscb1 = ['set(hline, ''LineStyle'', ''--'')'];cb2 = ['set(hline, ''LineStyle'', '':'')'];cb3 = ['set(hline, ''LineStyle'', ''-'')'];% Define the context menu itemsitem1 = uimenu(cmenu, 'Label', 'dashed', 'Callback', cb1);item2 = uimenu(cmenu, 'Label', 'dotted', 'Callback', cb2);item3 = uimenu(cmenu, 'Label', 'solid', 'Callback', cb3);2-528

uicontextmenuWhen the user extend-clicks on the line, the context menu appears, as shownin this figure:ObjectHierarchyRootFigureAxesUicontrolUimenuUicontextmenuUimenuUimenuSee Alsouicontrol, uimenu2-529

uicontextmenuWhen the user extend-clicks on the line, the context menu appears, as shownin this figure:ObjectHierarchyRootFigureAxesUicontrolUimenuUicontextmenuUimenuUimenuSee Alsouicontrol, uimenu2-529

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!