Effacer les filtres
Effacer les filtres

Adding a contextmenu to an axes that mimics pan/zoom/rotate's contextmenu behavior

2 vues (au cours des 30 derniers jours)
CJ
CJ le 30 Sep 2015
Hi, I'm trying to implement a customized UIcontextMenu
hFigure = figure;
currentAxes = axes;
hline = plot(currentAxes,1:10);
props_context.Parent = hFigure;
props_context.Tag = 'myContextMenu';
currentAxes.UIContextMenu = uicontextmenu(props_context);
hui = currentAxes.UIContextMenu;
props = [];
props.Label = 'Test';
props.Tag = 'Test';
props.Separator = 'off';
props.Callback = @foo;
ufullview = uimenu(hui,props);
So far so good. But notice that I'm not able to right click on the line in the axes and have the contextmenu popping up.
I know one way to work around this would be to turn the line's hittest or pickablepart 'off', however if I do that
hline.HitTest = 'off';
Now if I enable the data cursor mode, note that it won't work because I just turned the HitTest to 'off'.
So my question goes...is there a way to add a context menu that works just like the pan/zoom/rotate mode's context menu? Note that they work regardless where you click within the axes.
Thanks

Réponses (0)

Catégories

En savoir plus sur Interactive Control and Callbacks dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by