Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^2: Retrieving selections from Tk:TableMatrix

by chungley2000 (Initiate)
on Oct 12, 2018 at 13:48 UTC ( [id://1223926]=note: print w/replies, xml ) Need Help??


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

Hi, Aldebaran and Marshall

Thank you so so much for your time and efforts; I am really sorry about the late reply.

The program file has 2200 lines of code. I will see if I can get a smaller sample setup that replicates the problem; maybe I can solve it then. If I can get this replicable thru small code, I will post that; if I cannot, then I will clean up the current code as much as I can and post a link to GitHub. I had used Perl only as a newbie; so this may take a little time (hopefully by early next week)

In the meantime, I had included the header of the program below:

- the Perl version is 5.10.1 and the archname = "x86_64-linux-thread-multi" (I put a print statement right after the assignment using Config)

- I did an ls on /proj/pdkfc8/tools/perl/lib/perl5/site_perl/5.10.1, and I don't see any folder that resembles archname.

#!/usr/bin/perl -- -w =head1 NAME cmvcq.pl - Uses TK to create GUI windows to obtain metadata and files fro +m the original CMVC AMS family used by the Enablement team from 1998 to 2016+ =head1 DEPENDENCIES/CONDITIONS 1. Requires TK and DB/SQL skills for development. =head1 FUNCTIONS : : =head1 HISTORY Original build 06/21/2016 Updates - / /201 - - =cut #***************************************************************** +****************************** # Set environment #----------------------------------------------------------------- +------------------------------- use Config ; # gets the version and directory architecture - used + in BEGIN block BEGIN { # location of afs installed modules # NOTE: must place arch dependent location first to eliminate th +e arch name include # in the module name, e.g., x86_64-linux-thread-multi::Bundle:: +DBD::mysql $basedir = '/proj/pdkfc8/tools/perl' + ; $version = $Config{'version'} + ; # perl version $archname = $Config{'archname'} + ; # os architecture print("version=$version, archname=$archname\n\n"); push @INC, "$basedir/lib/perl5/site_perl/$version/$archname" + ; # at bottom of array push @INC, "$basedir/lib/perl5/site_perl/$version" + ; # at bottom of array push @INC, "$basedir/lib64/perl5/site_perl/$version/$archname +"; # at bottom of arra push @INC, "$basedir/lib64/perl5/site_perl/$version" + ; # at bottom of array push @INC, "$basedir/lib64/perl5" + ; # at bottom of array push @INC, "$basedir/share/perl5" + ; # at bottom of array # use this when trying to install DBI and DBD::DB2 perl modules. + DBD::DB2 would not install in aix push @INC, "$basedir/lib/site_perl/$version/$archname" + ; # at bottom of array for aix } # print "\n\nlarry $version, $archname"; # exit; 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 +ts # There is a bug in the Tk TableMatrix widget using th Ctrl-mouse +method to # select a row of data - it always select one less cell than the n +umber of # rows in the table. Module creator gve me fix, so make sure you +add it to # the the appropriate module - add changes and re-install. # # Following is from John Cerney who wrote the module: # It appears to be an issue with extended mode selection when the +number of # rows in the table is less than the number of columns. It looks l +ike an error # in finding the end of the row, using the max-row and not the max + column number # in the code. This can be fixed by making a mod to the TableMatri +x.pm file as # follows (diff -c output). # # *** TableMatrix.pm.bak Mon Jun 27 15:20:37 2016 # --- TableMatrix.pm Mon Jun 27 15:20:43 2016 # *************** # *** 769,775 **** # else # { # ## We're in a row header # ! $end = "$r,".$w->index('end','row'); # } # } # else # --- 769,775 ---- # else # { # ## We're in a row header # ! $end = "$r,".$w->index('end','col'); # } # } # else use Tk::BrowseEntry ; # used in $MakeSelectWIndow for @Choices use Tk::ProgressBar ; # not used use Tk::DateEntry ; # TK Calendar use Tk::TableMatrix::Spreadsheet ; # TK Calendar use Data::Dumper ; use List::Util qw(first); # for original attempt to determine if a +rray had a value (abandoned use)

Replies are listed 'Best First'.
Re^3: Retrieving selections from Tk:TableMatrix
by Marshall (Canon) on Oct 12, 2018 at 20:04 UTC
    Yes, see if you make a simple example using only a Tk::TableMatrix gizmo. Your large program has a lot of stuff that is irrelevant to the selection issues. I would imagine that you will wind up with something like 2 pages of code to play with.

    BTW. I don't know if you've figured this out or not yet, but if you have say a couple of thousand line display, the the scroll widget will become smaller and it's hard to see if you are actually on the very last line or not? In my application I added something like 3-5 blank lines at the end so that the user could be sure that they actually reached the last line when scrolling. Of course these blank lines were ignored for processing purposes. But my users really liked this feature.

Re^3: Retrieving selections from Tk:TableMatrix
by Aldebaran (Curate) on Oct 18, 2018 at 05:10 UTC

    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:

    I hope this helps,

      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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1223926]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2024-03-28 20:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found