http://qs321.pair.com?node_id=644299

jdtoronto has asked for the wisdom of the Perl Monks concerning the following question:

Esteemed Monks,

I am using Perl/Tk and Tk::DBI::Table which as a Tk::HList as part of it. I would like to have an action performed when I double click on an entry in the list, my code looks like this:

# Using the supplied SQL display a table view of the data. sub doDBItable { my ( $dbh, $SQL, $title ) = @_; debug("+doDBItable"); debug("SQL : $SQL"); 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 => 1, -debug => 0, )->pack( -expand => 1, -fill => 'both' ); $tkdbi->Subwidget('table')->configure( -selectmode => 'single', -command => \&procSelected, -browsecmd => sub{ printf "This is id: %s\n", $_[0] }, ); debug("-doDBItable"); return $top; } sub procSelected { printf "Process record %s\n", $_[0]; }
When I click on a row the '-browsecmd' code executes, but the '-command' callback only gets called when I select the row then hit enter. According to the Tk::HList docs, and everything I can find written about the HList widget, it should respond to the double-click also.

Any suggestions?

jdtoronto