Code covered by the BSD License  

Highlights from
GridLayout

image thumbnail

GridLayout

by

 

20 Nov 2010 (Updated )

An intuitive and flexible layout manager

GridLayoutDemo9()
% Automatic row/column sizing
function GridLayoutDemo9()

clc;
Parent = figure( ...
    'MenuBar', 'none', ...
    'NumberTitle', 'off', ...
    'Name', 'GridLayout: automatic row/column sizing');

% When the width of a column is declared as 'automatic' it takes the
% width of the widest cell in the column. The same holds for rows.
Layout = GridLayout(Parent, ...
    'NumRows', 4, ...
    'NumCols', 5, ...
    'RowHeight', {'a','*','*','*'}, ...
    'ColWidth', {'*','*','*','a','a'}, ...
    'CellColor', 'y');

% Adding children
UIArgs = {'Style','pushbutton', 'String','Click'};

uicontrol(Layout.Cell(1,4), UIArgs{:});
uicontrol(Layout.Cell(1,5), UIArgs{:});

Update(Layout);

Contact us