UIContextMenus for toggle buttons

11 views (last 30 days)
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');

Accepted Answer

Sean de Wolski
Sean de Wolski on 8 Aug 2012
Edited: Sean de Wolski on 8 Aug 2012
Nope; the uipushtool ignores the 'UIContextMenu' property.
  1 Comment
Brandon
Brandon on 8 Aug 2012
I was afraid that was the reality. I guess I will look into alternate solutions.
Thanks

Sign in to comment.

More Answers (0)

Categories

Find more on Interactive Control and Callbacks in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!