MATLAB Creating Graphical User Interfaces

(Barry) #1
Create Menus for GUIDE UIs


  • The DockControls property is set to 'on' and cannot be turned off until
    WindowStyle is no longer set to 'docked'.

  • If you undock a UI window created with WindowStyle 'docked', it will have not
    have a docking arrow unless the figure displays a menu bar or a toolbar (either
    standard or customized). When it has no docking arrow, users can undock it from the
    desktop, but will be unable to redock it there.


However, when you provide your own menu bar or toolbar using GUIDE, it can display
the docking arrow if you want the UI window to be dockable. See the following sections
and “Create Toolbars for GUIDE UIs” on page 6-108 for details.


Note:UIs that are modal dialogs (figures with WindowStyle set to 'modal') cannot
have menu bars, toolbars, or docking controls.


For more information, see the DockControls, MenuBar, ToolBar, and WindowStyle
property descriptions in Figure Properties.


Add Standard Menus to the Menu Bar


The figure MenuBar property controls whether your UI displays the MATLAB standard
menus on the menu bar. GUIDE initially sets the value of MenuBar to none. If you want
your UI to display the MATLAB standard menus, use the Property Inspector to set
MenuBar to figure.



  • If the value of MenuBar is none, GUIDE automatically adds a menu bar that displays
    only the menus you create.

  • If the value of MenuBar is figure, the UI displays the MATLAB standard menus and
    GUIDE adds the menus you create to the right side of the menu bar.


In either case, you can enable the user to dock and undock the window by setting the
figure's DockControls property to 'on'.


Create a Menu


1 Start a new menu by clicking the New Menu button in the toolbar. A menu title,
Untitled 1, appears in the left pane of the dialog box.

Free download pdf