MATLAB Creating Graphical User Interfaces

(ff) #1
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, the figure
property DockControls must be set to 'on'. You can set this property in the Property
Inspector. In addition, the MenuBar and/or ToolBar figure properties must be set to
'on' 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 opens docked in the desktop when you run the app.

  • 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 created with WindowStyle set to 'docked', the window will have
    not have a docking arrow unless the figure displays a menu bar or a toolbar. When the
    window has no docking arrow, users can undock it from the desktop, but will be
    unable to redock it.


To summarize, you can display docking controls with the DockControls property as long
as it is not in conflict with the figure's WindowStyle property.

NoteModal dialogs (figures with the WindowStyle property set to 'modal') cannot
have menu bars, toolbars, or docking controls.

9 Lay Out a Programmatic UI

Free download pdf