NAME
Tk::DBI::Table - Megawidget to display a sql-Statement in HList.
SYNOPSIS
use Tk;
use Tk::DBI::Table;
my $top = MainWindow->new;
my $tkdbi = $top->DBITable(
-sql => 'select * from table',
-dbh => $dbh,
-display_id => 0,
)->pack(expand => 1, -fill => 'both');
MainLoop;
DESCRIPTION
This is a megawidget to display a sql statement from your database. The features are: - every column has a ResizeButton for flexible width - The user can activate every Button and this will sort the column in the direction 'ASC', 'Desc' or 'None'.
WIDGET-SPECIFIC OPTIONS
-dbh => $dbh
A database handle, this will return a error if not defined.
-sql => 'select * from table'
A statement, this will return a error if not defined.
-debug [0|1]
This is a switch for debug output to the normal console (STDOUT)
-display_id [Off|On]
This is a switch for displaying the id column.
-columnWidths [colWidth_0, colWidth_1, colWidth_2, ...]
Default width for field columns.
-srtColumnStyle(option => value)
Style for sorted column.
METHODS
These are the methods you can use with this Widget.
$dbitable->refresh( [to_sort_col_number] );
Refresh the table and sort (optional) the col number.
$dbitable->sortcol( to_sort_col_number );
Refresh the table and sort the col number or return the actually col sort number.
$dbitable->direction( ['NONE', 'ASC' or 'DESC'] );
Give a new direction. no parameter will return the actually direction.
ADVERTISED WIDGETS
'table' => HList-Widget
This is a normal HList widget. I.e.:
$dbitable->Subwidget('table')->configure(
-command = sub{ printf "This is id: %s\n", $_[0] },
};
'HB_<column number>' => Button-Widget
This is a (Resize)Button widget. This displays a Compound image with text and image.
AUTHOR
xpix@netzwert.ag
Copyright (C) 2003 , Frank (xpix) Herrmann. All rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
KEYWORDS
Tk::DBI::*, Tk::ResizeButton, Tk::HList
__END__