showcontextmenu

版本 1.4.0.0 (7.5 KB) 作者: Igor
Simple way to show contextmenu on left click in a nice drop-down way.
395.0 次下载
更新时间 2012/6/21

查看许可证

Use as follows:
---------------------------------
hcmenu1 = uicontextmenu;
uimenu(hcmenu1,...);
uimenu(hcmenu1,...);
showcontextmenu(hObj,hcmenu1);
---------------------------------
Try test_showcontextmenu.m for usage example.

This also contains a number of trivial routine functions:
getParentFigure(hObject)
%returns hObject's parent figure

getPositionOnFigure( hObject,units )
%returns absolute position of object on a figure

getRelPosition( hObject,units )
%get(hObject,'Position') with specific 'units'

getCurrentPoint( hFigure,units )
%get(hFigure,'currentpoint') with specific 'units'

引用格式

Igor (2024). showcontextmenu (https://www.mathworks.com/matlabcentral/fileexchange/31448-showcontextmenu), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R2011a
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Interactive Control and Callbacks 的更多信息

Community Treasure Hunt

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

Start Hunting!
版本 已发布 发行说明
1.4.0.0

added test_showcontextmenu4:
in this example, in contrast to test_showcontextmenu, right-click menu is shown below the button (not on click position)

1.3.0.0

Thanks to Jesse this now supports uipushtool and uitoggletool objects (toolbar items).
usage example provided in test_showcontextmenu3.

1.2.0.0

+support for lines etc. (objects without 'units' property (menu would be displayed on click position)
+"assert" removed with if..error

1.0.0.0