MATLAB Creating Graphical User Interfaces

(Barry) #1
Create Menus for Programmatic UIs

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 it.

  • 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.


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


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

Free download pdf