I have a simple GUI with 5 subplots; using h(n)=imshow(im), I display 4 grayscales and 1 RGB superimposed with markers using the 'hold on', 'plot', and 'hold off' commands. For each handle I defined a 'ButtonDownFcn' callback. What I am finding is that Matlab does not detect the middle and side mouse buttons in the RGB, but consistently detects the left and right-mouse buttons when clicking on objects in the RGB subplot. However, when I hover over any of the grayscale subplots, all mouse buttons are detected all the time. If I do not plot the markers over the RGB, all mouse buttons are detected, so it seems that updating the markers on the RGB using 'set(ax.h,XData,xvals,YData,yvals)' upsets the applecart.
I've attached a demo (missedmouseclicks.m) to illustrate the issue, and I sure hope that someone can show me the error of my ways.
Many thanks in advance,
Jan
Best Answer