How to add context menu to imrect ?
古いコメントを表示
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....
採用された回答
その他の回答 (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.
カテゴリ
ヘルプ センター および File Exchange で Build Interactive Tools についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!