How to show the position of your mouse in a GUI that has two Axes?
Ältere Kommentare anzeigen
Dear all,
I have a GUI that has two axes, Main_Axes and Side_Axes.
Now I want when mouse is over a point in the Main_Axes, it will show the same position of the mouse in the Side_Axes.
So I made a function that I called 'mouseMove', that start * the mouse position
function mouseMove (object, eventdata)
C = get (gca, 'CurrentPoint');
X = C(1,1);
Y = C(1,2);
I = getimage;
hold on
plot(X, Y, 'y*')
hold off
Now in the callback I add this code
set(handles.Main_Axes,'HandleVisibility','ON');
set(handles.Side_Axes,'HandleVisibility','OFF');
imshow(I) % to show 'I' in the Main_Axes
axes(handles.Side_Axes)
set (gca, 'WindowButtonMotionFcn', @mouseMove);
This makes the yellow star always appear in the Main_Axes, but it should appear in the Side_Axes.
Any idea how to fix that?
Meshoo
Akzeptierte Antwort
Weitere Antworten (2)
John BG
am 8 Feb. 2016
0 Stimmen
Hi Meshoo
have a look to http://uk.mathworks.com/matlabcentral/fileexchange/33107-mouse-position?s_tid=srchtitle
may be you can modify GetMousePosition.m to achive
'when mouse is over a point in the Main_Axes, it will show the same position of the mouse in the Side_Axes.'
what is the purpose of doing so?
1 Kommentar
Meshooo
am 9 Feb. 2016
Ruben Gaitan Ortiz
am 16 Nov. 2018
0 Stimmen
I had a similar problem. Thank you!
Kategorien
Mehr zu Data Exploration finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!