Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
ButtonDownFcn disabled

Subject: ButtonDownFcn disabled

From: Henrik

Date: 17 Nov, 2010 13:59:05

Message: 1 of 3

Hi,

I have been trying to get the ButtonDownFcn callback to work, but for some reason it is completely impossible. I have read up on all the common problems people have with this, such as resetting of the axis properties when new data is plotted etc and also dsabling the HitTest of the image displayed in the axes. However, none of this seems to help. To the problem:

I am implementing a ButtonDownFcn in an image being displayed in a GUI. The axes in which the image is displayed are located inside a uipanel. Every time the image is being drawn in the axis, the following code gets executed:

axes(handles.axes_image);
h = image(handles.im_oecf);
set(h, 'ButtonDownFcn', @track_mouse);

When clicking in the image, the callback routine track_mouse never gets called. I have tried replacing it with simpler callbacks, such as 'disp(''hello'')' etc but that doesn't work either. I have tried enabling/disabling HitTest properties and all sorts of things, but still it doesn't work. I have tried to move the axes out of the uipanel and that doesn't help either. I think I have exhausted all my possibilities by now. The thing is that in another GUI I made some time back, exactly this code works as expected, but I simply cannot find what differs between the two GUIs.

It seems I must have disabled something somewhere, or maybe obscured the image somehow, or what? Any help is highly appreciated.

Best regards,

Henrik

Subject: ButtonDownFcn disabled

From: Joseph

Date: 17 Nov, 2010 16:01:04

Message: 2 of 3

It appears you're having a similar issue to what I am having. Try clicking elsewhere in the GUI and see if your track_mouse function is called. It appears the buttondownfcn property does not work with images (?). It does appear to work with plots however.


"Henrik " <Hremove.thisEliasson46@gmail.com> wrote in message <ic0n39$qu8$1@fred.mathworks.com>...
> Hi,
>
> I have been trying to get the ButtonDownFcn callback to work, but for some reason it is completely impossible. I have read up on all the common problems people have with this, such as resetting of the axis properties when new data is plotted etc and also dsabling the HitTest of the image displayed in the axes. However, none of this seems to help. To the problem:
>
> I am implementing a ButtonDownFcn in an image being displayed in a GUI. The axes in which the image is displayed are located inside a uipanel. Every time the image is being drawn in the axis, the following code gets executed:
>
> axes(handles.axes_image);
> h = image(handles.im_oecf);
> set(h, 'ButtonDownFcn', @track_mouse);
>
> When clicking in the image, the callback routine track_mouse never gets called. I have tried replacing it with simpler callbacks, such as 'disp(''hello'')' etc but that doesn't work either. I have tried enabling/disabling HitTest properties and all sorts of things, but still it doesn't work. I have tried to move the axes out of the uipanel and that doesn't help either. I think I have exhausted all my possibilities by now. The thing is that in another GUI I made some time back, exactly this code works as expected, but I simply cannot find what differs between the two GUIs.
>
> It seems I must have disabled something somewhere, or maybe obscured the image somehow, or what? Any help is highly appreciated.
>
> Best regards,
>
> Henrik

Subject: ButtonDownFcn disabled

From: Henrik

Date: 17 Nov, 2010 16:18:05

Message: 3 of 3

Hi Joseph,

Thanks. Unfortunately this does not seem to be the case, since the exact same code works in another GUI, so I don't think the problem is that the buttondownfunc won't work for images.

/Henrik

"Joseph " <don'twannapostit@nopers.com> wrote in message <ic0u80$f3p$1@fred.mathworks.com>...
> It appears you're having a similar issue to what I am having. Try clicking elsewhere in the GUI and see if your track_mouse function is called. It appears the buttondownfcn property does not work with images (?). It does appear to work with plots however.
>
>
> "Henrik " <Hremove.thisEliasson46@gmail.com> wrote in message <ic0n39$qu8$1@fred.mathworks.com>...
> > Hi,
> >
> > I have been trying to get the ButtonDownFcn callback to work, but for some reason it is completely impossible. I have read up on all the common problems people have with this, such as resetting of the axis properties when new data is plotted etc and also dsabling the HitTest of the image displayed in the axes. However, none of this seems to help. To the problem:
> >
> > I am implementing a ButtonDownFcn in an image being displayed in a GUI. The axes in which the image is displayed are located inside a uipanel. Every time the image is being drawn in the axis, the following code gets executed:
> >
> > axes(handles.axes_image);
> > h = image(handles.im_oecf);
> > set(h, 'ButtonDownFcn', @track_mouse);
> >
> > When clicking in the image, the callback routine track_mouse never gets called. I have tried replacing it with simpler callbacks, such as 'disp(''hello'')' etc but that doesn't work either. I have tried enabling/disabling HitTest properties and all sorts of things, but still it doesn't work. I have tried to move the axes out of the uipanel and that doesn't help either. I think I have exhausted all my possibilities by now. The thing is that in another GUI I made some time back, exactly this code works as expected, but I simply cannot find what differs between the two GUIs.
> >
> > It seems I must have disabled something somewhere, or maybe obscured the image somehow, or what? Any help is highly appreciated.
> >
> > Best regards,
> >
> > Henrik

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us