Tickit::Widget::Table::Paged - table widget with support for scrolling/paging
version 0.002
use Tickit; use Tickit::Widget::Table::Paged; my $tbl = Tickit::Widget::Table::Paged->new; $tbl->{row_offset} = 0; $tbl->add_column( label => 'Left', align => 'left', width => 8, ); $tbl->add_column( label => 'Second column', align => 'centre' ); $tbl->add_row('left', 'middle') for 1..100; Tickit->new(root => $tbl)->run;
WARNING: This is a preview release. API is subject to change in future, please get in contact if you're using this, or wait for version 1.000.
This widget provides a scrollable table implementation.
Instantiate. Will attempt to take focus.
Clear all data in the table.
Add a row to the table. Data should be provided as a list with one item per column.
Returns $self.
Add a new column. Takes the following named parameters:
width - (optional) number of columns
type - (optional) data type, currently only supports 'text' (the default)
align - (optional) align left, center or right
Accessor for the activation callback - if called without parameters, will return the current coderef (if any), otherwise, will set the new callback.
This callback will be triggered via "key_activate":
$code->($row_index, $row_data_as_arrayref)
If multiselect is enabled, the callback will have the following:
$code->( [$highlight_row_index, @selected_row_indices], $highlight_row_data_as_arrayref, @selected_rows_as_arrayrefs )
(the selected row data + index list could be empty here)
Accessor for multi_select mode - when set, this allows multiple rows to be selected.
Number of lines to request.
Number of columns to request.
True if there's a vertical scrollbar.
True if there's a horizontal scrollbar.
Current row offset (vertical scroll position).
Returns the list of lines currently visible in the display.
Returns the Tickit::Rect representing the header area.
Returns the Tickit::Rect representing the body area.
Returns the Tickit::Rect representing the scroll bar.
Render the header area.
Render the table.
Render the body area.
Add widgets for the column.
Render the scrollbar.
Render a given cell.
Handle reshape requests.
Distribute space between columns.
Called when a window has been assigned to the widget.
Expose the given rows.
Returns the index of the currently-highlighted row.
Returns the position of the highlighted row taking scrollbar into account.
Update scroll information after changing highlight position.
Change the highlighted row.
Go to the previous row.
Move to the next row.
Move to the first row.
Move to the last row.
Go up a page.
Go down a page.
Current vertical scrollbar position.
Total number of rows.
Current scrollbar height.
Positions of the scrollbar indicator.
Rectangle representing the area covered by the current scrollbar.
Size of the vertical scrollbar.
Move to the next column.
Move to the previous column.
Move to the first column.
Move to the last column.
Activate the highlighted item.
Toggle selected row.
Current list of pending features:
Storage abstraction - the main difference between this widget and Tickit::Widget::Table is that this is designed to work with a storage abstraction. The current abstraction implementation needs more work before it's reliable enough for release, so this version only has basic arrayref support.
Column and cell highlighting modes
Proper widget-in-cell support
Formatters for converting raw cell data into printable format (without having to go through a separate widget)
Tickit::Widget::Table - older table implementation based on Tickit::Widget::HBox and Tickit::Widget::VBox widgets. Does not support scrolling and performance isn't as good, so it will eventually be merged with this one.
Text::ANSITable - not part of Tickit but has some impressive styling capabilities.
get_style_pen, get_style_text, get_style_values, key_focus_next_after, key_focus_next_before, on_pen_changed, parent, pen, redraw, requested_cols, requested_lines, requested_size, resized, set_parent, set_pen, set_requested_size, set_style, set_style_tag, set_window, style_classes, take_focus, window, window_lost
Tom Molesworth <cpan@entitymodel.com>
Copyright Tom Molesworth 2012-2013. Licensed under the same terms as Perl itself.
To install Tickit::Widget::Table::Paged, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Tickit::Widget::Table::Paged
CPAN shell
perl -MCPAN -e shell install Tickit::Widget::Table::Paged
For more information on module installation, please visit the detailed CPAN module installation guide.