Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Tk::JBrowseEntry gives me this error I dont understand

by jdtoronto (Prior)
on Sep 26, 2003 at 18:36 UTC ( [id://294523]=perlquestion: print w/replies, xml ) Need Help??

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

Esteemed Monks,

The description of Tk::JBrowseEntry - so despite it being a copy this here type of installation I went ahead and installed it sucessfully on my AS 5.8.0 (bld 806) system on WinXP. I use Eclipse IDE with the Perl add-in.

In this code snippet:

my $dsquery = $cfr->JBrowseEntry( -label => 'Data Source', -width => '20', -height => '5', -variable => \$state->{dsSrcName}, -browsecmd => \&doGetDatasource, -state => 'normal' )->grid();
Which seems fine to me according to the docs I get the following error:
Use of uninitialized value in addition (+) at K:/Perl/site/lib/Tk/JBro +wseEntry.pm line 854.
OK, so what is that saying? Well, here is the relevant portion from the source code for the module.
if ($^O =~ /Win/i) { #$y1 -= 3; #print "-bw=$w->{-borderwidth}= y1 was=$y1=\n"; $y1 -= 3 - ($w->{-borderwidth} || 2); #print "-bw=$w->{-borderwidth}= y1 now=$y1=\n"; #$unitpixels = $e->height - ((2 * $bd) + 1) + 6; $unitpixels = $e->height + 1; #$ht = ($wheight * $unitpixels) + 10; $ht = ($wheight * $unitpixels) + (2 * $bd) + 4; #print "-???- eheight=$e->height= BD=$bd= up=$unitpixels= wh=$wheight= + HT=$ht=\n"; #$ee = $w->Subwidget("textpart"); $ee = $w->Subwidget("frame"); $x1 = $ee->rootx; $x2 = $a->rootx + $a->width; $width = $x2 - $x1 854: $rw = $width + $w->{-borderwidth}; $x1 += 1; #FUDGE MORE FOR WINDOWS (THINNER BORDER) TO MAK +E DROPDOWN LINE UP VERTICALLY W/ENTRY&BUTTON. }
The author seems to be doing some calculation and fudging to do with Windows, but I am not confident enough to go delving into the module.

Has anybody had any experience with this module? Apart from this annoying message it appears to be working okay. I can turn off the warnings once out of development, but I would really like to know why this is happening and fix it if possible.

As always your assistance is much appreciated.

jdtoronto

Replies are listed 'Best First'.
Re: Tk::JBrowseEntry gives me this error I dont understand
by converter (Priest) on Sep 26, 2003 at 23:30 UTC

    The problem appears to be that the only assignment to $w->{-borderwidth} is the return value of delete $args->{-borderwidth} at line 255, and then only if $args->{-borderwidth} is defined. This leaves $w->{-borderwidth} with the undefined value. I can't get to a machine with Windows to test this, so I could be missing something.

    If I'm right, the quickest solution would probably be to specify a value for the -borderwidth attribute in your constructor. A -borderwidth value of 0 (zero) might be a good starting point (this is effectively what you're using now). If -borderwidth => 0 doesn't look right, experiment a bit.

    converter

      Well, indeed that was the problem! If I set -borderwidth => 2 Then it all works as expected. The message only occured for me when the button was clicked to make a selection (the down arrow button). I haven't had a chance to install the module on any of my *nix boxes yet, but I will do so and file a bug report with the author after some more testing.

      Thank you for taking the time to look at the code!

      jdtoronto

Re: Tk::JBrowseEntry gives me this error I dont understand
by jasonk (Parson) on Sep 26, 2003 at 19:48 UTC

    What it is saying is that one of the values that is being added is undefined, so basically one of the math lines in there evaluates to 'some_number + undef'. We can't help you figure out which one since you didn't indicate which line in the source you pasted is the line the error came from, but I bet if you uncomment those print statements you'll find it.


    We're not surrounded, we're in a target-rich environment!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (3)
As of 2024-04-26 00:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found