- Add a Main Menu: In the Component Browser, right-click on the figure and select "Add Menu."
- Add Submenus: Right-click on the main menu and select "Add Menu" to create submenus. Repeat for additional levels.
- Ensure Proper Hierarchy: Assign each submenu as a child of the menu directly above it.
A appdesigner menu question
    5 views (last 30 days)
  
       Show older comments
    
- How to increase the number of levels below the menu bar in appdesigner?
 fig(1) fig(1)
 fig(2) fig(2)
- i create the “Menu”——fig(1),But it didn't show up the “app.Menu_8” in the fig(2)?
0 Comments
Answers (1)
  Shubham
 on 7 Oct 2024
        To increase submenu levels in App Designer, ensure each menu item is a child of its parent menu.
Here's how this can be done: 
Here is an example of a MATLAB App Designer script that implements a multi-level menu bar:
classdef MyApp < matlab.apps.AppBase
    properties (Access = public)
        UIFigure  matlab.ui.Figure
        MainMenu  matlab.ui.container.Menu
        SubMenu1  matlab.ui.container.Menu
        SubMenu2  matlab.ui.container.Menu
        SubSubMenu1 matlab.ui.container.Menu
    end
    methods (Access = private)
        function createComponents(app)
            app.UIFigure = uifigure('Visible', 'off');
            app.UIFigure.Position = [100 100 640 480];
            app.UIFigure.Name = 'My App';
            app.MainMenu = uimenu(app.UIFigure);
            app.MainMenu.Text = 'Main Menu';
            app.SubMenu1 = uimenu(app.MainMenu);
            app.SubMenu1.Text = 'SubMenu 1';
            app.SubMenu2 = uimenu(app.MainMenu);
            app.SubMenu2.Text = 'SubMenu 2';
            app.SubSubMenu1 = uimenu(app.SubMenu1);
            app.SubSubMenu1.Text = 'SubSubMenu 1';
            app.UIFigure.Visible = 'on';
        end
    end
    methods (Access = public)
        function app = MyApp
            createComponents(app)
            registerApp(app, app.UIFigure)
            if nargout == 0
                clear app
            end
        end
        function delete(app)
            delete(app.UIFigure)
        end
    end
end
Please note that there is no limit to menu depth in App Designer.  Ensuring each submenu is linked correctly to its parent will help manage multi-level menus effectively. 
For more information on “uimenu”, refer to the following MathWorks documentation link: 
Hope this helps! 
0 Comments
See Also
Categories
				Find more on Desktop in Help Center and File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
