Versión (7,46 KB) por Igor
Simple way to show contextmenu on left click in a nice drop-down way.
394 descargas
Actualizado 21 jun 2012

Ver licencia

Use as follows:
hcmenu1 = uicontextmenu;
Try test_showcontextmenu.m for usage example.

This also contains a number of trivial routine functions:
%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'

Citar como

Igor (2024). showcontextmenu (, MATLAB Central File Exchange. Recuperado .

Compatibilidad con la versión de MATLAB
Se creó con R2011a
Compatible con cualquier versión
Compatibilidad con las plataformas
Windows macOS Linux
Más información sobre Interactive Control and Callbacks en Help Center y MATLAB Answers.

Community Treasure Hunt

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

Start Hunting!
Versión Publicado Notas de la versión

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

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

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