How to add context menu to imrect ?
Mostrar comentarios más antiguos
How to add context menu to imrect ..I have a image i want to select a particular part using imrect nd then i want to add context menu to dat part how can i do the same./?????/ Its urgent.. help me asap....
Respuesta aceptada
Más respuestas (1)
Here's the barebones of how I managed to do this:
hrect = imrect(gca, [1 1 10 10]);
hrectchild = get(hrect, 'Children');
hcmenu = get(hrectchild(1),'UIContextMenu');
% get the handle for the context menu for the imrect
Once you have the handle for the context menu you can use the function uimenu to add items to the default context menu something like this:
itemnew = uimenu(hcmenu, 'Label', '[Text for menu here]', 'Callback', @callbacknamehere);
% add a menu item to copy data to workspace
Depending what you want to do you'll probably want to create a callback function (or just use an inline function) for your new menu item.
Categorías
Más información sobre Display Image en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!