MATLAB Creating Graphical User Interfaces

(Barry) #1

6 Lay Out a UI Using GUIDE



  • “Add Standard Menus to the Menu Bar” on page 6- 93

  • “Create a Menu” on page 6- 93

  • “Add Items to a Menu” on page 6- 96

  • “Additional Drop-Down Menus” on page 6- 98

  • “Cascading Menus” on page 6- 98


When you create a drop-down menu, GUIDE adds its title to the menu bar. You then
can create menu items for that menu. Each menu item can have a cascading menu, also
known as a submenu, and these items can have cascading menus, and so on.

How Menus Affect Figure Docking

By default, when you create a UI with GUIDE, it does not create a menu bar for that
UI. You might not need menus for your UI, but if you want the user to be able to dock or
undock the UI window, it must contain a menu bar or a toolbar. This is because docking
is controlled by the docking icon, a small curved arrow near the upper-right corner of the
menu bar or the toolbar, as the following illustration shows.

Figure windows with a standard menu bar also have a Desktop menu from which the
user can dock and undock them.

To display the docking arrow and the Desktop > Dock Figure menu item, use the
Property Inspector to set the figure property DockControls to 'on'. You must also set
the MenuBar and/or ToolBar figure properties to 'figure' to display docking controls.

The WindowStyle figure property also affects docking behavior. The default is
'normal', but if you change it to 'docked', then the following applies:


  • The UI window opens docked in the desktop when you run it.

Free download pdf