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');

采纳的回答

Sean de Wolski
Sean de Wolski 2012-8-8
编辑:Sean de Wolski 2012-8-8
Nope; the uipushtool ignores the 'UIContextMenu' property.
  1 个评论
Brandon
Brandon 2012-8-8
I was afraid that was the reality. I guess I will look into alternate solutions.
Thanks

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Interactive Control and Callbacks 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by