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

Hi,
I'm having trouble getting CTRL+c and CTRL+x shortcut keys to work properly with the Tk::Tablematrix widget and was wondering if this is just me or is it a bug.

I get "Free to wrong pool.."-error and program crashes when attempting to copy selected text in the widget with CTRL+c.

Win XP
Tk v804.027
perl v5.8.3
Tk::TableMatrix v1.1

Code below is "TableMatrixTest" from the "Demos"-section in the TableMatrix-module. Could anyone try to run it and see if CTRL+c and CTRL+x works ok?

use Tk; use Tk::TableMatrix; use Data::Dumper qw( DumperX); my $top = MainWindow->new; my $arrayVar = {}; foreach my $row (0..20){ foreach my $col (0..10){ $arrayVar->{"$row,$col"} = "r$row, c$col"; } } my $t = $top->Scrolled('TableMatrix', -rows => 21, -cols => 11, -width => 6, -height => 6, -titlerows => 1, -titlecols => 1, -variable => $arrayVar, -selectmode => 'extended', -resizeborders => 'both', -titlerows => 1, -titlecols => 1, -bg => 'white', # -state => 'disabled' # -colseparator => "\t", # -rowseparator => "\n" ); $t->tagConfigure('active', -bg => 'gray90', -relief => 'sunken'); $t->tagConfigure( 'title', -bg => 'gray85', -fg => 'black', -relief => + 'sunken'); # $t->bind("<Any-Enter>", sub { $t->focus }); $t->pack(-expand => 1, -fill => 'both'); Tk::MainLoop;

Thanks for all help.

Replies are listed 'Best First'.
Re: Win32 Tk::TableMatrix CTRL+c bug?
by JediWizard (Deacon) on Sep 18, 2004 at 19:15 UTC

    I have tested this code on Windows XP under ActiveState perl 5.6.1 and 5.8.4; CTRL-c and CTRL-x both worked. I'm not sure if this helps given that you are running perl 5.8.3, but perhaps you could upgrade to 5.8.4?

    May the Force be with you
      Thanks JediWizard! What version of Tk are you using on perl 5.8.4 and what build number is that (of perl that is)?

      I've tried with perl 5.8.3 build 809, which comes with Tk 800.024, and installed Tk::TableMatrix with ppm-utility and then everything worked ok. Problem is I need some other Tk-Widgets too, for instance Tk::JPEG. This won't install with ppm..So when I installed this with the CPAN-module it automatically upgraded Tk to 803.027..

      With Tk 803.027 Tk::TableMatrix won't even run when installed with the ppm-util.

      When I then afterwards tried to manually install Tk::TableMatrix from CPAN everything seem to work fine, except for the before mentioned problem with CTRL+c etc..

      Then tried with latest version of perl from Activestate, 5.8.4 build 810 and installed TableMatrix with ppm - then same problem as with perl 5.8.3 - would not compile..Got this error msg:

      Had to create Tk::XlibVtab unexpectedly at C:/Perl/lib/DynaLoader.pm line 253. 2be4fb8 is not a hash at C:/Perl/site/lib/Tk/Widget.pm line 190.

      This application has requested the Runtime to terminate it in an unusual way.

      Please contact the application's support team for more information.

      What a mess..Is there any way to get specific widgets (Tk::JPEG etc) for perl 5.8.3-809 without having to upgrade to latest version of Tk?

      update:
      -Version number correction.

        Ok..finally sorted out this mess..
        Went back to perl 5.8.3 build 809 and Tk 800.024, installed Tk::TableMatrix with ppm and found .ppd file for installing Tk::JPEG after searching in google..

        For those interested in installing Tk::JPEG on windows with perl 5.8, with ppm, type:

        ppm install http://theoryx5.uwinnipeg.ca/ppms/Tk-JPEG.ppd

        Confirmed working (Tk::JPEG, that is), btw..:)
        Problem solved..for now...

        Tk 823.024 ?
Re: Win32 Tk::TableMatrix CTRL+c bug?
by JamesNC (Chaplain) on Sep 19, 2004 at 15:36 UTC
    Just guessing, but I didn't see you mention if you have Tcl installed. Tk::TableMartix says in its doc that it can only use a Tcl Array or Tcl command. It is just me, but I think the author of the module should throw an exception if it can find Tcl in addition to embedding it in the Docs.

    Install Tcl? ... I haven't had time to learn it so I am of no help on that advice.

    There are other Table like modules in Tk, that don't depend on Tcl. I use Tk::HList for such tasks. Perhaps other monks have a few ideas.

    JamesNC
      Tk::TableMatrix does not need Tcl (as other Perl/Tk widgets, too). All "Tcl" bits in the documentation are probably left-overs of the original Tcl doc.
        That is great news! Would you please post a tested example that works under Win32 w/ ActiveState's perl distribution like the posted question? I would be very interested in learning how to use Widgets designed for Tcl without having Tcl installed :) Thanks!
      Well..I actually have Tcl installed, thanks to Courage and his fine tutorial on vTcl..