Adding a contextmenu to an axes that mimics pan/zoom/rotate's contextmenu behavior
1 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Interactive Control and Callbacks 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!