in reply to repeating Tk widgets for data editing
Like zentara I am not sure what you want to do either, but for displaying lists or tanbles of data in Tk there are some interesting mega-widgets, and you can make your own should you need to. One that I like is Tk::DBI::Table, just give it some SQL and it displays the data! Like this:
Of course you can look at the code for the module to see how the mega-widget is created. I hope this is of some use, it is a LONG time since I looked at Access (basically 5 years ago when I transitioned my only client who was using it to MySQL).use Tk; use Tk::DBI::Table; my $dbh = createDBconnection(); my $SQL = qq~SELECT * FROM mytable~; my $window = doDBItable( $dbh, $SQL, 'My display window' ); sub doDBItable { my ( $dbh, $SQL, $title ) = @_; if ( not defined $title ) { $title = "List Preview" } my $top = MainWindow->new( -title => $title ); $top->geometry("600x400+50+50"); my $tkdbi = $top->DBITable( -sql => $SQL, -dbh => $dbh, -display_id => 0, -debug => 0, )->pack( -expand => 1, -fill => 'both' ); debug("-doDBItable"); return $top; } sub createDBconnection { use DBI; my %attr = ( PrintError => 0, RaiseError => 0. ); if ( my $dbh = DBI->connect( 'DBI:mysql:mydatabase', 'username', 'pa +ssword', \%attr ) ) { return ($dbh); } else { print "Cannot open MySQL connection: " . DBI::errstr() . "\n"; return 0; } }
Caveat Example taken from working code but not tested, in fact it is guaranteed not to work and has hidden magic that will make your coffee go sour as well!
|
|---|