Hi there,
I am working on a more complex GUI application with several axes objects. For pan and zoom in the axes I am using java callbacks of the parent uicontainer object of the axes object (Axes has no java object). This works quite good.
Now I tried to add a uicontextmenu to my axes. I discovered that it will never show up as long as a java callback on the parent object is active. If i deactivate the java callbacks for testing, the contextmenu works as expected. I also tried to use the "ButtonDownFcn" for some plotted lines. It shows exactly the same behavior.
It seems that, somehow, the java callbacks are preventing the execution of all axes callbacks. Is it possible to workaround this behavior? Can I forward the callback somehow to the axes?
Thanks for any help
Here is a small example wich simplifies the problem
fig = figure;
panel = matlab.ui.container.internal.UIContainer('Parent', fig);
jpanel = panel.JavaFrame.getPrintableComponent;
jpanel= handle(jpanel, 'CallbackProperties');
set(jpanel, 'MouseDraggedCallback', @(h,e)disp('drag'));
set(jpanel, 'MouseClickedCallback', @(h,e)disp('Click'));
ax = axes('Parent', panel);
plot(ax, 1:5,1:5);
hcmenu = uicontextmenu;
uimenu(hcmenu, 'Label', 'item 1', 'Callback', @(h,e)disp('item 1'));
ax.UIContextMenu = hcmenu;
I am using Matlab 2016a