User guide previous pagenext page

4.2: Setting defaults for all windows Go back up one level

As well as modifying the defaults used in one window, it is possible to override the defaults used for all windows. This makes use of the special "0" handle that roughly corresponds to the MATLAB environment. Note, however, that defaults set at the window level take precedence.

The example below shows how defaults can be set for the panel title-bar color and font for all windows, but the font size is overridden for the second window:

uiextras.set( 0, 'DefaultHBoxBackgroundColor', [0.3 0.3 0.3] );
uiextras.set( 0, 'DefaultBoxPanelTitleColor', 'y' );
uiextras.set( 0, 'DefaultBoxPanelFontSize', 14 );
f1 = figure();
h = uiextras.HBox( 'Parent', f1, 'Padding', 10, 'Spacing', 10 );
p1 = uiextras.BoxPanel( 'Parent', h, 'Title', 'Panel 1' );
p2 = uiextras.BoxPanel( 'Parent', h, 'Title', 'Panel 2' );
f2 = figure();
uiextras.set( f2, 'DefaultBoxPanelFontSize', 20 );
p3 = uiextras.BoxPanel( 'Parent', f2, 'Title', 'Panel 3' );

It is important to note that although the default has been set system-wide, it is not preserved between MATLAB sessions.


© 2014 The MathWorks Ltd Terms of Use Patents Trademarks