GUI Question
GUI Question
(OP)
Hello.
I am working on matlab 7.3.0 R2006b.
I am making a gui that has a picture (handle.axes1) on it and some operation buttons.
My problem is that i want to take the cordinates of the mouse on mouse click on the gui.
This cordinates(x,y) i want to take them on these 2 param each time i click the left mouse button.
Thank you..
I am working on matlab 7.3.0 R2006b.
I am making a gui that has a picture (handle.axes1) on it and some operation buttons.
My problem is that i want to take the cordinates of the mouse on mouse click on the gui.
This cordinates(x,y) i want to take them on these 2 param each time i click the left mouse button.
Thank you..





RE: GUI Question
%%%%%%%%%%%%%%%%%%%%%%%%%%%
clf
clear all
figure;
%the mouse-click sets a flag for point aquisition
set(gcf,'windowbuttondownfcn','hit=1;');
%start looping and waiting for a mouse click
stopit=0;
while (stopit==0)
%check for valid object and chek for line 1
%and see if the mouse was clicked
if ~isempty(gco) & hit==1
%get the mouse position in graph units
mouse = get(gca,'currentpoint');
mouse
%wait for the next click
hit=0;
end
drawnow
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
now each time i click on the figure i get my cordinates on x and y. example:
mouse =
0.5288 0.5161 1.0000
0.5288 0.5161 0
What i want now is to do the same thing by clicking on GUI.I have a handle.axes1 on my gui that loads a picture and i want to take the pixel cordinates of that picture by clicking on it.
I will be very happy to get that.
Thanx