addmenuitem
Adds an action item to the given menu in the Compose user interface. addmenuitem is only available in the Compose GUI.
Syntax
addmenuitem(rbname, name, menutext, callback, tooltip, statustip)
addmenuitem(uiPopupMenu, name, menutext, callback, tooltip, statustip)
Inputs
- rbname
- The name of the ribbon menu.
- uiPopupMenu
- The handle of the ribbon menu or pop-up menu.
- name
- The action item's name; must be unique.
- menutext
- The action item's text, which appears in the menu.
- callback
- The name of the callback function, which gets called when the action is clicked.
- tooltip
- The action item's tooltip.
- statustip
- The action item's status tip that is displayed on the status bar.
Outputs
- uiAction
- The handle to the action item.
Examples
pm=addribbonmenu('Test'); % create a 'Test' ribbon page as menu
ab = addmenuitem(pm,'Show Test Label','Show Test','HandleTest','','');
ac = addmenuitem('Test','Show Test Label 1', 'Show Test 1','HandleTest_1','','');
% create popup menus
pp=addpopupmenu('Test', 'Test 2'); % create a sub popup menu "Test 2" under ribbon page 'Test'
pp1=addpopupmenu(pp, 'Test 3'); % create a popup menu 'Test 3' under ribbon page 'Test'
% create a menu actions with label 'Show Test Label 2' and name 'Show Test 2' under sub popup menu 'Test 2'
ad = addmenuitem(pp,'Show Test Label 2','Show Test 2','HandleTest_2','A test 2 menu action','clicked Test 2');
% create a menu actions with label 'Show Test Label 3' and name 'Show Test 3' under sub popup menu 'Test 3'
ae = addmenuitem(pp1,'Show Test Label 3','Show Test 3','HandleTest_3','A test 3 menu action','clicked Test 3');
function HandleTest()
disp('Show Test is handled');
end
function HandleTest_1()
disp('Show Test 1 is handled');
end
function HandleTest_2()
disp('Show Test 2 is handled');
end
function HandleTest_3()
disp('Show Test 3 is handled');
end