Using ButtonDownFcn w/ mapshow() in GUI

1 vue (au cours des 30 derniers jours)
Dan
Dan le 29 Juin 2011
Hi,
I'm just starting to experiment w/ the GUI capabilities of MATLAB. I'm building a simple GUI which will allow for the display and manipulation of geotiffs and shapefiles. For testing purposes I created a bare-bones GUI which includes an axes object and a pushbutton. The button does nothing more than simply call mapshow() on a geotiff and shapefile at this point, but I was happy to see them displayed properly in the axes object.
Now on to my question: the next thing I wanted to play with was displaying the easting and northing location underneath the mouse cursor when a mouse button is clicked. So, I used GUIDE to define a ButtonDownFcn callback for the axes object. In the code I query the current point and update a couple of static text objects.
However, this callback only gets hit when I click on the axes object prior to displaying the geotiff/shapefile via mapshow(). Before calling mapshow() the callback works as expected. Once I call mapshow() the callback does not get called when I click over the image.
What is the proper way to specify callbacks when using mapshow()? Or is there a more appropriate way altogether to use mapshow capabilities within a MATLAB GUI?
Thanks!
-- Dan

Réponse acceptée

Walter Roberson
Walter Roberson le 29 Juin 2011
mapshow() is creating an object on the axes, and the callback for that function has priority.
Try
h = mapshow(...);
set(findobj(h),'HitTest','off');
  1 commentaire
Dan
Dan le 29 Juin 2011
Thanks Walter! This gave me a nudge in the right direction.
As you pointed out I needed to turn off 'HitTest' for the graphics object returned from mapshow(). To make it work as expected I then ended up finding the axes object created by mapshow() and assigned my ButtonDownFcn callback to it.
Thank you very much.

Connectez-vous pour commenter.

Plus de réponses (0)

Tags

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by