Missing context menu for "axes" contained in "uifigure" parent
7 次查看(过去 30 天)
显示 更早的评论
Hello,
I would like to enable the default context menu functionality for axes objects inside a uifigure parent (or a panel within a uifigure).
For an axes within a figure object, the context menu appears when the user has selected one of the axes toolbar buttons and subsequently right clicks on the axes. However, for an axes within a uifigure object, the context menu does not appear. See code below for a guided example of this behavior difference.
Is it possible to enable this default context menu functionality for an axes within a uifigure hierarchy?
% Compare default context menu functionality with Axes objects created in a
% figure and uifigure parent.
% Figure parent
h = figure;
ax = axes(h);
title(ax, 'This is a ''figure'' with an ''axes'' child')
disp('A figure has been created with an axes child.')
disp('Select a toolbar interaction button, such as the Zoom button.')
disp('Right click on the axes and observe the context menu which appears.')
input('Press enter to continue');
disp('---')
% UIFigure parent
hUI = uifigure;
axUI = axes(hUI);
title(axUI, 'This is a ''uifigure'' with an ''axes'' child')
disp('A uifigure has been created with an axes child.')
disp('Select a toolbar interaction button, such as the Zoom button.')
disp('Note that no context menu appears.')
disp('How can one enable the default context menus for axes contained in a uifigure?')
input('Press enter to close figures');
delete(h)
delete(hUI)
1 个评论
Luc
2021-3-15
I had the same problem and noticed that this will do the trick:
app.UIAxesZoom=zoom(app.UIAxes);
setAllowAxesZoom(app.UIAxesZoom,app.UIAxes,1);
回答(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!