UIContextMenu disabled when axes is used

조회 수: 2 (최근 30일)
Jakob Sørensen
Jakob Sørensen 2014년 5월 19일
답변: Jakob Sørensen 2014년 5월 19일
Hi there,
I've created a small GUI using the GUIDE tool (its the lazy way, I know). I have an axes I use to show an image, and I would like to add an option to save that image. I wanted to do so by adding an uicontextmenu (right-click menu), with a "Save image as..." option. I've create the menu and added it to the axes, which works fine initially. However when I use the axes to show the image (doesn't happen until you click a button), the uicontexmenu no longer works.
Is there any clever way to fix this? An option where the uicontextmenu is added after the image is shown, is perfectly acceptable (in fact it would be preferred). I've tried the following line of code, but that does not work:
set(handles.axesMainAxes, 'uicontextmenu', cMenu_axesMainAxes_Callback);
Any help is greatly appreciated, thanks :-).
  댓글 수: 1
Jakob Sørensen
Jakob Sørensen 2014년 5월 19일
Update: I changed the code line to the following
set(handles.axesMainAxes, 'uicontextmenu', handles.cMenu_axesMainAxes);
and I no longer recieve any errors from the code. The uicontextmenu still does not work however.

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

채택된 답변

Jakob Sørensen
Jakob Sørensen 2014년 5월 19일
It solved it to add the uicontextmenu to the image, rather than to the axes. So when displaying the image, add the menu:
image(classifiedImage,'uicontextmenu',handles.cMenu_axesClassification);
Also remember the handles. in front of the uicontextmenu tag name, and remember that it is the tag name, not the function name which should be used.

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by