필터 지우기
필터 지우기

ButtonDownFcn on children of UIFigure

조회 수: 6 (최근 30일)
Paco Langjahr
Paco Langjahr 2019년 11월 28일
댓글: Paco Langjahr 2020년 1월 7일
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
Paul Shoemaker
Paul Shoemaker 2019년 12월 3일
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

댓글을 달려면 로그인하십시오.

채택된 답변

Chidvi Modala
Chidvi Modala 2020년 1월 2일
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
  댓글 수: 1
Paco Langjahr
Paco Langjahr 2020년 1월 7일
Thank you very much for this clear and simple answer!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Develop uifigure-Based Apps에 대해 자세히 알아보기

태그

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by