ButtonDownFcn and WindowButt​onMotionFu​nction on a GUI

조회 수: 16 (최근 30일)
Fer
Fer 2015년 7월 14일
댓글: Fer 2015년 7월 15일
Hello,
Using this tutorial I have succeeded in making a crosshair follow the motion of my mouse when I click the left button. However I have only been able to do this in a regular figure, and have had problems implementing it on my GUI. I tried specifying the axes I want it to show on, because my GUI, made with GUIDE, has three axes figures, but it will show on the whole window. I'm assuming the WindowButtonMotionFcn works on the whole window. I know there is a buttondown callback for the axes, but what about for mouse movement? In short, I want to be able to program an action on clicking and dragging on any of the axes drawn in my GUI.
Thank you

답변 (1개)

Jan
Jan 2015년 7월 15일
The WindowButtonDownFcn and WindowButtonMotionFcn concern the complete window (as the name implies). But you can check the coordinates of the pointer in these callbacks easily and limit the motion to the position of wanted axes object using some min and max calls.
  댓글 수: 1
Fer
Fer 2015년 7월 15일
Okay, so I should write a condition that executes WindowsButtonMotionFcn only within certain coordinates? Would I include this in the callback for my button down function? I suppose there is a command to fund the curren position of my pointer. Could you maybe suggest some documentation as to how to proceed? Thank you!!

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by