Tickit::Widget::GridBox(3pm) | User Contributed Perl Documentation | Tickit::Widget::GridBox(3pm) |
"Tickit::Widget::GridBox" - lay out a set of child widgets in a grid
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:
Constructs a new "Tickit::Widget::GridBox" object.
Takes the following named arguments:
Returns the number of rows or columns in the grid.
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.
The following options are recognised:
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.
Returns the child widget at the given cell in the grid. If the row or column index are beyond the bounds of the grid, or if there is no widget in the given cell, returns "undef".
Convenient shortcut to call "get" on an entire row or column of the grid.
Inserts a new row into the grid by moving the existing rows after it lower down. Any child widgets in the referenced array will be set on the cells of the new row, at an column corresponding to its index in the array. A child of "undef" will be skipped over.
Inserts a new column into the grid by moving the existing columns after it to the right. Any child widgets in the referenced array will be set on the cells of the new column, at a row corresponding to its index in the array. A child of "undef" will be skipped over.
Shortcut to inserting a new row after the end of the current grid.
Shortcut to inserting a new column after the end of the current grid.
Deletes a row of the grid by moving the existing rows after it higher up.
Deletes a column of the grid by moving the existing columns after it to the left.
Paul Evans <leonerd@leonerd.org.uk>
2018-07-30 | perl v5.26.2 |