ButtonDownFcn on children of UIFigure
8 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Paco Langjahr
am 28 Nov. 2019
Kommentiert: Paco Langjahr
am 7 Jan. 2020
I'm trying to trigger the ButtonDownFcn of a UIFigure when clicking on a child axes. In the below answer it was written that clicking on a child of the UIFigure would also trigger the callback, but this seems not to be true...
Steps to reproduce the problem:
-Create a new blank app
-Pull one axes onto the figure
-Add a callback for ButtonDownFcn of the UIFigure
-Add a breakpoint in that callback
-Click on the axes ---->> Nothing happens!
1 Kommentar
Paul Shoemaker
am 3 Dez. 2019
You might need to toggle the hittest property of the children objects "off." For the above example with the axes in the figure, you would get the handle for the axes (possibly with gca command) and set hittest off.
set(gca,'hittest','off'); % Or replace gca with the axes you want
I think that'll make it work.
Paul Shoemaker
MatlabInvesting.com
Akzeptierte Antwort
Chidvi Modala
am 2 Jan. 2020
From my understanding, you are trying to add a callback for ButtonDownFcnof the UIFigure to trigger the callback, when clicking on child axes. From the link that you have referenced, your requirement can be achieved by using WindowButtonDownFcn callback and not ButtonDownFcn. ButtonDownFcn callback is triggered when user clicks a blank area of the UI Figure
WindowButtonDownFcn callback executes when the user clicks:
- A blank area of the UI figure
- A UI component within the UI figure that supports the ButtonDownFcn property
- A graphics object within the UI figure that supports the ButtonDownFcn property
You can find WindowButtonDownFcn callback in the window section of UI Figure callbacks.
For more information on different callbacks, you can refer to Common callbacks, Keyboard Callbacks, Window Callbacks section here
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Develop uifigure-Based Apps finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!