Tickit::Widget::GridBox - lay out a set of child widgets in a grid
Tickit::Widget::GridBox
use Tickit; use Tickit::Widget::GridBox; use Tickit::Widget::Static; my $gridbox = Tickit::Widget::GridBox->new( style => { col_spacing => 2, row_spacing => 1, }, children => [ [ Tickit::Widget::Static->new( text => "top left" ), Tickit::Widget::Static->new( text => "top right" ) ], [ Tickit::Widget::Static->new( text => "bottom left" ), Tickit::Widget::Static->new( text => "bottom right" ) ], ], ); Tickit->new( root => $gridbox )->run;
This container widget holds a set of child widgets distributed in a regular grid shape across rows and columns.
The default style pen is used as the widget pen.
The following style keys are used:
The number of columns of spacing between columns
The number of rows of spacing between rows
Constructs a new Tickit::Widget::GridBox object.
Takes the following named arguments:
Optional. If present, should be a 2D ARRAYref of ARRAYrefs containing the Tickit::Widget children to display in the grid. They are all added with no additional options.
Tickit::Widget
Sets the child widget to display in the given grid cell. Cells do not need to be explicitly constructed; the grid will automatically expand to the size required. This method can also be used to replace an existing child at the given cell location. To remove a cell entirely, use the remove method.
remove
The following options are recognised:
Values for the expand setting for this column or row of the table. The largest expand setting for any cell in a given column or row sets the value used to distribute space to that column or row.
expand
Removes the child widget on display in the given cell. May shrink the grid if this was the last child widget in the given row or column.
Paul Evans <leonerd@leonerd.org.uk>
To install Tickit::Widgets, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Tickit::Widgets
CPAN shell
perl -MCPAN -e shell install Tickit::Widgets
For more information on module installation, please visit the detailed CPAN module installation guide.