UIContextMenus for toggle buttons
10 次查看(过去 30 天)
显示 更早的评论
Greetings Matlabers
Is is possible to at uicontext menus to toggle buttons. When I assign a context menu to my button it does not show up when the object is right clicked over. However, I can assign the same context menus to other objects (lines for example) and it shows up. This leads me to think that my problem is not with the context menu but with the toggle button or how it is assigned.
Has anyone experienced/worked with this before?
The toggle button works as expected before the uicontext menu is assigned. It continues to work after with an exception of the context menu I just assigned.
Thanks in advance for any help
dcmenu = uicontextmenu;
dcitem(1) = uimenu(dcmenu, 'Label', 'X', 'Checked', 'on');
dcitem(2) = uimenu(dcmenu, 'Label', 'Y', 'Checked', 'on');
dcitem(3) = uimenu(dcmenu, 'Label', '1/X', 'Checked', 'off');
dcitem(4) = uimenu(dcmenu, 'Label', '1/Y', 'Checked', 'off');
dcitem(5) = uimenu(dcmenu, 'Label', 'X/Y', 'Checked', 'off');
hToolbar = uitoolbar();
hS.legend = uipushtool('Parent', hToolbar, ...
'CData', createCData('legend'),...
'ClickedCallback',@legend_hideFcn,...
'TooltipString', 'Toggle Legend');
0 个评论
采纳的回答
Sean de Wolski
2012-8-8
编辑:Sean de Wolski
2012-8-8
Nope; the uipushtool ignores the 'UIContextMenu' property.
更多回答(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!