edit zoom contex menu
2 次查看(过去 30 天)
显示 更早的评论
Hello all,
Is there any way to edit the zoom built-in conext menu? I want to add an option to exit zoom mode.
I dont want to create a custom context menu. I want just to edit the original one.
I did it this way:
z = zoom(h.FIG);
z.Enable = 'on';
zoomMenu = findobj(h.FIG, 'Tag', 'ZoomContextMenu');
MENU_exitZoom = uimenu(zoomMenu, 'Text', 'Exit zoom mode', 'Callback', @C_exitZoomMode);
The problem is that the context menu handle is empty if I dont open the menu first with the mouse.
After that, the handle is there, and I can sucessufly add my new option, and it indeed exits zoom mode.
Mathworks states that you cannot add items to the built-in zoom context menu, but you can replace it with your own. But since I did it sucessfully, I suppose this is not entirely true. The only problem is that the menu handle doesn't appear if I dont make the menu show up at least once.
Anyway, I want to create a menu that has all the options of the built-in menu, but with one extra option created by me. Any way for doing this?
Regards,
André
4 个评论
Luc
2021-3-15
I had a similar problem in the app designer and noticed that adding these lines did the trick for me:
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!