Mouse Click callback on an image - temporarily disable

10 visualizaciones (últimos 30 días)
Jason
Jason el 14 de Ag. de 2019
Comentada: Jason el 14 de Ag. de 2019
Hello, I have a GUI (created by guide) where everytime I load an image and display in an axes component I assign a button down function (called ImageClickCallback) so everytime I click on the image my function ImageClickallback executes. This all works fine.
axes(handles.axes1)
imageHandle=imshow(img,[low,high]); % Display Image
set(imageHandle,'ButtonDownFcn',@ImageClickCallback); % Assign callback to ButtonDown event
I am wanting to now use a mouse click on the image to draw lines (I know how to do this) but everytime I click the image the original ImageClickCallback executes. So my question is can I pause the original ButtonDownFcn callback ?
Thanks

Respuesta aceptada

Geoff Hayes
Geoff Hayes el 14 de Ag. de 2019
Jason - why not just remove the original callback just prior to wanting to draw the lines
set(imageHandle,'ButtonDownFcn',[]);
You could then restore it later when needed.
  7 comentarios
Geoff Hayes
Geoff Hayes el 14 de Ag. de 2019
The problem might be because of the trailing space character in the string
'ButtonDownFcn '
Try replacing with
set(handles.imH,'ButtonDownFcn',[]);
Jason
Jason el 14 de Ag. de 2019
Yes thts it....thanks for spotting the error
Jason

Iniciar sesión para comentar.

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by