How do I get the UICONTEXTMENU to appear on an image in my GUI that I created using GUIDE?
5 ビュー (過去 30 日間)
古いコメントを表示
I am inserting an image in one of the axes that I have in my GUI using the following code:
axes(handles.axes3);
Im=image(imread('flowers.tif'));
axes3 is the handle for the axes where I want to insert the image. I have a UICONTEXTMENU associated with this axes. However, if I right click on the image, I do not get the UICONTEXTMENU. I have to right click either on the X or Y axis of the axes to get the UICONTEXTMENU.
How do I get the UICONTEXTMENU to appear by clicking anywhere on the image and not only on the X or the Y axis of the axes?
採用された回答
MathWorks Support Team
2009 年 6 月 27 日
When you right click on the image, it becomes the current object and not the axes which contains it. The UICONTEXTMENU is associated with the axes. That's why it appears only when you right click on the X or the Y axis of the axes as the axes becomes the current object.
To get the UICONTEXTMENU when you right click on the image, you have to make sure that the image does not become the current object. To achieve this, you will have to set the 'HitTest' property of the image to 'off' (this property is set to 'on' by default).
Here is an example:
axes(handles.axes3);
Im=image(imread('flowers.tif'),'hittest','off');
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Interactive Control and Callbacks についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!