CurrentPoint and ButtonDownFcn give different results
3 views (last 30 days)
Show older comments
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 Comments
Walter Roberson
on 12 Jul 2018
You appear to be using R2014b or later. You should have a look at the newer PickableParts properties.
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Interactive Control and Callbacks in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!