×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

GUI Question

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..

RE: GUI Question

(OP)
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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources