CurrentPoint and ButtonDownFcn give different results
조회 수: 3 (최근 30일)
이전 댓글 표시
Hi,
I have a figure with axes x=8-10 microns, y=30-40 microns. When I click on the figure, in the image region (not the background), and then execute
ax=gca;
ax.CurrentPoint(1,1)
ax.CurrentPoint(1,2)
in the command window, I get two values which are sensible (the first lies between 8 and 10, and the second between 30 and 40). Within my code, I also have the lines
set(myax,'ButtonDownFcn',@CallBackFcn,'HitTest','on')
set(myfig,'ButtonDownFcn',@CallBackFcn,'HitTest','off')
When I run my code and click on (roughly) the same point as before, nothing happens. But, when I click on the background, to the right of the actual image, I get very large values (over 100 for x and a y>40). Can someone explain if my 'HitTest' 's are set incorrectly, and if so, what the proper way is? The callback function used for the axes and the figure is the same. (Note that the labelling of my y axis runs opposite to the traditional way; values at the bottom are greater than those at the top; this is intentional due to the details of my project).
Thanks for your help!
댓글 수: 2
Walter Roberson
2018년 7월 12일
You appear to be using R2014b or later. You should have a look at the newer PickableParts properties.
채택된 답변
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!