UIContextMenu when defined does not show in Matlab 2021b

조회 수: 3 (최근 30일)
aamir ibrahim
aamir ibrahim 2024년 11월 11일
댓글: aamir ibrahim 2024년 11월 12일
I have a class that inherits from matlab component container. I define a uiaxes in the setup method. Since, the setup method does not allow access to the parent figure of the object, I cannot add a uicontextmenu to the figure. To get around this I added a CreateFcn.
In the CreateFcn I define a uicontextmenu and add it to the uiaxes defined in the setup method. When I check the uiaxes object, the menu is added correctly. The menu although does not show up when I right click in the created GUI.
I have the same code and it works on every version after 2021b. Could someone help with how I can make this compatible with 2021b?

답변 (1개)

Bruno Luong
Bruno Luong 2024년 11월 12일
uiaxes/uifigure are not compatible wit axes/figure. I recommend simply do not make a switch.
  댓글 수: 2
aamir ibrahim
aamir ibrahim 2024년 11월 12일
Can you explain this. I am using uiaxes and uifigure.
aamir ibrahim
aamir ibrahim 2024년 11월 12일
This is what worked for me. In R2021b, I had to use a ButtonDownFcn for the uiaxes and then launch and position the context menu from the ButtonDownFcn. Although this does remove the default axes interactivity and I had to reset that manually using enableDefaultInteractivity.

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

카테고리

Help CenterFile Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by