in reply to Perl::TK Class::DBI Oracle
If I am the author of Tk::DBI::From, I will seperate data and presentation classes, and make sure the presentation class provides a common interface towards data classes. If I only have the time to implement interface to MySQL, as least other people can easily add their data classes for other databases, according to the open interface I defined. Unfortunately that module was developed in a closed structure.
You said that you have the database portion implemented already, and is seeking for Tk GUI part. I think Tk::Table meets the general requirement of rendering database table pretty well. I made up some demo:
use Tk; use Tk::Table; use Data::Dumper; use strict; my ($row, $col); #data, in your case, come from database my @cell_vars; foreach $row (0 .. 9) { my @row_vars; foreach $col (0 .. 9) { push @row_vars, $row * $col; } push @cell_vars, \@row_vars; } #presentation my $mw = MainWindow->new; $mw->geometry("600x250"); my $table = $mw->Table(-rows => 9, -columns => 9, -scrollbars => "se", -fixedrows => 1, -fixedcolumns => 1, -takefocus => 1)->pack; foreach $col (1 .. 9) { my $col_header = $mw->Button(-text => "Column " . $col); $table->put(0, $col, $col_header); } foreach $row (1 .. 9) { my $row_header = $mw->Button(-text => "Row " . $row); $table->put($row, 0, $row_header); foreach $col (1 .. 9) { my $cell = $mw->Entry(-width => 10, -textvariable => \$cell_va +rs[$row][$col]); $table->put($row, $col, $cell); } } #manipulate data $cell_vars[5][6] = "foo"; MainLoop;
As you can see, it is very easy to set/get the cell values, and modification to data is automatically reflected on screen (you don't need to do anything). If you only want to display data, but not editing, replace Entry with Label.
Good Luck!
|
|---|