in reply to Re^2: Retrieving selections from Tk:TableMatrix
in thread Retrieving selections from Tk:TableMatrix

Hi chungley2000,

I did a bit more poking around with Config and found the things I was looking for with code like this:

for ( keys %Config ) { if ( defined $Config{$_} ) { if ( $Config{$_} =~ m%/x86_64-linux-gnu/% ) { say "$_ matched: $Config{$_}"; } }

Where the module data will go is certainly system-dependent. What I did to suss out where perl was looking for modules was type

$ perl -le 'print for @INC'

, and then I paid attention to where cpan was creating files such as DBI.pm . I've reformatted what you had. For example, I deleted whitespace between the module name and the semi-colon. Many of those had wrapped around and gotten newlines where they shouldn't be. And whatever you have needs to be broken down into chunks:

$ ./7.tk.pl version=5.26.1, archname=x86_64-linux-gnu-thread-multi all modules loaded without error Use of uninitialized value $update in concatenation (.) or string at . +/7.tk.pl line 52. return is made it this far without error $ cat 7.tk.pl #!/usr/bin/perl -w use 5.011; #***************************************************************** # Set environment #----------------------------------------------------------------- use Config; # gets the version and directory architecture - BEGIN { my $basedir = '/proj/pdkfc8/tools/perl'; my $version = $Config{'version'}; # perl version my $archname = $Config{'archname'}; # os architecture print("version=$version, archname=$archname\n\n"); push @INC, "$basedir/lib/perl5/site_perl/$version/$archname"; push @INC, "$basedir/lib/perl5/site_perl/$version"; push @INC, "$basedir/lib/site_perl/$version/$archname"; # at botto +m of array } use DBI; # database module use File::Basename; # basepath module use Tk; # TK gui module use Tk::Text; # TK text widget use Tk::TableMatrix; # used in $showSelection to show query resul use Tk::BrowseEntry; # used in $MakeSelectWIndow for @Choices use Tk::DateEntry; # TK Calendar use Tk::TableMatrix::Spreadsheet; # TK Calendar use Data::Dumper; use Path::Tiny; say "all modules loaded without error"; ## create windows my $return = create_windows(); say "return is $return"; sub create_windows { my $mw1 = new MainWindow; $mw1->title("CMVC File Retriever"); #----------------------------------------------------------------- # Set up two frames: # - $frameTop - contains radio buttons for selecting table. # - $frameBottom - contains button to quit without update. #----------------------------------------------------------------- my $update = undef; my $frameTop = $mw1->Frame( -label => "QUERY Table (Last update as of $update)", -relief => 'groove', -borderwidth => 1 )->pack( -side => 'top', -fill => 'both' ); my $table = "fileview"; # default table (turns radio button on) $frameTop->Radiobutton( -text => "file table", -value => "fileview", -variable => \$table )->pack( -side => 'left' ); return "made it this far without error"; } $

I hope this helps,

Replies are listed 'Best First'.
Re^4: Retrieving selections from Tk:TableMatrix
by chungley2000 (Initiate) on Oct 19, 2018 at 06:29 UTC
    Hi, Aldebaran

    I cannot thank you enough with your help.

    I finally did a simpler version that is about 180 lines of code and posted it here: https://github.com/chungley2000/perlTKIssueSample/

    I found a different solution to my problem which does not involve the use of "selectioncommand". Instead, when the "Get Files" button is clicked, I just used the $table->curselection() and resolved my solution then. I am still very interested in why the selectioncommand stopped working. According to the users, it was working before. But I cannot seems to "trigger" it. I tried to do a $table->get("0,0") to see if that is a "selection get" that the https://metacpan.org/pod/distribution/Tk-TableMatrix/pod/TableMatrix.pod was referring to, but that didn't do it.

    2018-10-20 Athanasius linkified links