Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TugboatEng on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

GUI Question

Status
Not open for further replies.

pavlosh83

Computer
Joined
Apr 30, 2007
Messages
2
Location
CY
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 found something that works on a figure..now i wont that to work on my GUI.Especially i want it to work on a handle.axes1 on my GUI.

%%%%%%%%%%%%%%%%%%%%%%%%%%%
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top