f



uninitialized value using a Tk Text widget

x-posted from perlmonks

I have several widgets displayed including a scrollable listbox and
some scrollable text boxes. If a user clicks in one of my textboxes
and begins to use the down arrow key when the textbox is empty, perl
throws "Use of uninitialized value in numeric ne (!=) at ...Text.pm
line 1223" I tried to duplicate this with a small example, but

[code]
use Tk;

my $mw = MainWindow->new();
$mw->Scrolled('Text')->pack();
$mw->Text()->pack; MainLoop;
[/code]

does not display the problem for either the Scrolled Text or the
simple Text, so I figured the problem lied in my personal bindings of
<Up> and <Down>. I removed the bindings and it stilled was there. I
was able to duplicate the issue using the widget demo "widget". If you
run "widget" and click on "1. Basic editable text." and delete all of
the text in the text widget. You can replicate it by now down-
arrowing.

This is primarily running on windows machines
0
bravos_1
9/2/2008 9:13:30 PM
comp.lang.perl.tk 4721 articles. 0 followers. pharrendorf (19) is leader. Post Follow

6 Replies
431 Views

Similar Articles

[PageSpeed] 42

On Sep 2, 5:13 pm, bravo...@yahoo.com wrote:
> x-posted from perlmonks
>
> I have several widgets displayed including a scrollable listbox and
> some scrollable text boxes. If a user clicks in one of my textboxes
> and begins to use the down arrow key when the textbox is empty, perl
> throws "Use of uninitialized value in numeric ne (!=) at ...Text.pm
> line 1223" I tried to duplicate this with a small example, but
>
> [code]
> use Tk;
>
> my $mw = MainWindow->new();
> $mw->Scrolled('Text')->pack();
> $mw->Text()->pack; MainLoop;
> [/code]
>
> does not display the problem for either the Scrolled Text or the
> simple Text, so I figured the problem lied in my personal bindings of
> <Up> and <Down>. I removed the bindings and it stilled was there. I
> was able to duplicate the issue using the widget demo "widget". If you
> run "widget" and click on "1. Basic editable text." and delete all of
> the text in the text widget. You can replicate it by now down-
> arrowing.
>
> This is primarily running on windows machines


use warnings;

--S
0
smallpond
9/2/2008 9:19:15 PM
On Sep 2, 2:19 pm, smallpond <smallp...@juno.com> wrote:
> On Sep 2, 5:13 pm, bravo...@yahoo.com wrote:
>
>
>
> > x-posted from perlmonks
>
> > I have several widgets displayed including a scrollable listbox and
> > some scrollable text boxes. If a user clicks in one of my textboxes
> > and begins to use the down arrow key when the textbox is empty, perl
> > throws "Use of uninitialized value in numeric ne (!=) at ...Text.pm
> > line 1223" I tried to duplicate this with a small example, but
>
> > [code]
> > use Tk;
>
> > my $mw = MainWindow->new();
> > $mw->Scrolled('Text')->pack();
> > $mw->Text()->pack; MainLoop;
> > [/code]
>
> > does not display the problem for either the Scrolled Text or the
> > simple Text, so I figured the problem lied in my personal bindings of
> > <Up> and <Down>. I removed the bindings and it stilled was there. I
> > was able to duplicate the issue using the widget demo "widget". If you
> > run "widget" and click on "1. Basic editable text." and delete all of
> > the text in the text widget. You can replicate it by now down-
> > arrowing.
>
> > This is primarily running on windows machines
>
> use warnings;
>
> --S

what exactly are you looking for?  I do have 'use warnings;' being
'used'.  This is all the details I am getting.
0
bravos_1
9/2/2008 9:27:21 PM
some additional info...

this line being warned about is:

if (not defined $w->{'origx'} or ($w->{'lastindex'} != $i) )

now if I use the sample script I had in my orig post, the first time I
down arrow, $w-<{'origx'} is not defined, but gets defined directly
after.  The next <Down> shows $w->{'lastindex'} as "", yet perl
doesn't complain ever.

In my script, if I continue to down arrow (3-6 more times on avg), the
warning goes away.  In the widget demo, it does not seem to ever go
away.

$w->{'lastindex'} never changes from being undefined.


0
bravos_1
9/2/2008 9:42:34 PM
On Sep 2, 5:27 pm, bravo...@yahoo.com wrote:
> On Sep 2, 2:19 pm, smallpond <smallp...@juno.com> wrote:
>
>
>
> > On Sep 2, 5:13 pm, bravo...@yahoo.com wrote:
>
> > > x-posted from perlmonks
>
> > > I have several widgets displayed including a scrollable listbox and
> > > some scrollable text boxes. If a user clicks in one of my textboxes
> > > and begins to use the down arrow key when the textbox is empty, perl
> > > throws "Use of uninitialized value in numeric ne (!=) at ...Text.pm
> > > line 1223" I tried to duplicate this with a small example, but
>
> > > [code]
> > > use Tk;
>
> > > my $mw = MainWindow->new();
> > > $mw->Scrolled('Text')->pack();
> > > $mw->Text()->pack; MainLoop;
> > > [/code]
>
> > > does not display the problem for either the Scrolled Text or the
> > > simple Text, so I figured the problem lied in my personal bindings of
> > > <Up> and <Down>. I removed the bindings and it stilled was there. I
> > > was able to duplicate the issue using the widget demo "widget". If you
> > > run "widget" and click on "1. Basic editable text." and delete all of
> > > the text in the text widget. You can replicate it by now down-
> > > arrowing.
>
> > > This is primarily running on windows machines
>
> > use warnings;
>
> > --S
>
> what exactly are you looking for?  I do have 'use warnings;' being
> 'used'.  This is all the details I am getting.


Sorry, I meant:

use strict;

That's what warns about undeclared/uninitialized variables.

--S
0
smallpond
9/2/2008 10:16:39 PM
On Sep 2, 3:16 pm, smallpond <smallp...@juno.com> wrote:
> On Sep 2, 5:27 pm, bravo...@yahoo.com wrote:
>
>
>
> > On Sep 2, 2:19 pm, smallpond <smallp...@juno.com> wrote:
>
> > > On Sep 2, 5:13 pm, bravo...@yahoo.com wrote:
>
> > > > x-posted from perlmonks
>
> > > > I have several widgets displayed including a scrollable listbox and
> > > > some scrollable text boxes. If a user clicks in one of my textboxes
> > > > and begins to use the down arrow key when the textbox is empty, perl
> > > > throws "Use of uninitialized value in numeric ne (!=) at ...Text.pm
> > > > line 1223" I tried to duplicate this with a small example, but
>
> > > > [code]
> > > > use Tk;
>
> > > > my $mw = MainWindow->new();
> > > > $mw->Scrolled('Text')->pack();
> > > > $mw->Text()->pack; MainLoop;
> > > > [/code]
>
> > > > does not display the problem for either the Scrolled Text or the
> > > > simple Text, so I figured the problem lied in my personal bindings of
> > > > <Up> and <Down>. I removed the bindings and it stilled was there. I
> > > > was able to duplicate the issue using the widget demo "widget". If you
> > > > run "widget" and click on "1. Basic editable text." and delete all of
> > > > the text in the text widget. You can replicate it by now down-
> > > > arrowing.
>
> > > > This is primarily running on windows machines
>
> > > use warnings;
>
> > > --S
>
> > what exactly are you looking for?  I do have 'use warnings;' being
> > 'used'.  This is all the details I am getting.
>
> Sorry, I meant:
>
> use strict;
>
> That's what warns about undeclared/uninitialized variables.
>
> --S

I'm using strict as well.

use strict also does not (can not) complain about this problem.  The
var is properly declared, and strict does not know/care about the
defined value of a var.

The is nothing syntactically wrong with something like this:

use strict;

my $a = 'a';
# $a is a string
print "1 -> $a\n";

undef $a;
# $a is now undefined
print "2 -> $a\n";

$a = "1";
# $a is a string again
print "3 -> $a\n";

$a += 1;
# $a is now an integer  (rough perlish way to do a C type atoi)
print "4 -> $a\n";

0
bravos_1
9/2/2008 10:31:19 PM
On Sep 2, 6:31 pm, bravo...@yahoo.com wrote:
> On Sep 2, 3:16 pm, smallpond <smallp...@juno.com> wrote:
>
>
>
> > On Sep 2, 5:27 pm, bravo...@yahoo.com wrote:
>
> > > On Sep 2, 2:19 pm, smallpond <smallp...@juno.com> wrote:
>
> > > > On Sep 2, 5:13 pm, bravo...@yahoo.com wrote:
>
> > > > > x-posted from perlmonks
>
> > > > > I have several widgets displayed including a scrollable listbox and
> > > > > some scrollable text boxes. If a user clicks in one of my textboxes
> > > > > and begins to use the down arrow key when the textbox is empty, perl
> > > > > throws "Use of uninitialized value in numeric ne (!=) at ...Text.pm
> > > > > line 1223" I tried to duplicate this with a small example, but
>
> > > > > [code]
> > > > > use Tk;
>
> > > > > my $mw = MainWindow->new();
> > > > > $mw->Scrolled('Text')->pack();
> > > > > $mw->Text()->pack; MainLoop;
> > > > > [/code]
>
> > > > > does not display the problem for either the Scrolled Text or the
> > > > > simple Text, so I figured the problem lied in my personal bindings of
> > > > > <Up> and <Down>. I removed the bindings and it stilled was there. I
> > > > > was able to duplicate the issue using the widget demo "widget". If you
> > > > > run "widget" and click on "1. Basic editable text." and delete all of
> > > > > the text in the text widget. You can replicate it by now down-
> > > > > arrowing.
>
> > > > > This is primarily running on windows machines
>
> > > > use warnings;
>
> > > > --S
>
> > > what exactly are you looking for?  I do have 'use warnings;' being
> > > 'used'.  This is all the details I am getting.
>
> > Sorry, I meant:
>
> > use strict;
>
> > That's what warns about undeclared/uninitialized variables.
>
> > --S
>
> I'm using strict as well.
>
> use strict also does not (can not) complain about this problem.  The
> var is properly declared, and strict does not know/care about the
> defined value of a var.


Don't know.  widget does not complain when I do what you describe
with perl 5.8.8 and Tk 804.027502

Are your perl and Tk up to date?

--S
0
smallpond
9/3/2008 2:27:33 PM
Reply:

Similar Artilces:

Perl/Tk Data Entry using embedding widgets and Tk Events problems.
Hello, Referring to S.Lidie book on Mastering Perl/Tk I tried to get the example starting on page 185 working. The code works well to display the entry window. I found much more difficult to write to code to retrieve the users data after entry. The recommendation of using the callback routine with a second button still did not allow access to the data entered by the user. The error reported is: Tk error:: Can't call method "get" on an udefined value at.... I use Perl 5-8-3 for MS win32 windows. Has anybody got any success with this example ?? Thanks, Stevo On 7 ...

perl -e "use Tk" failed after installing perl tk
Now I want to debug perl script through ptkdb under Windows XP. I installed perl tk 804.028 using the below command first because ptkdb depends on perl tk. ppm install Tk But some errors pop out when the command(perl -e "use Tk") exec after installing perl tk, " Can't locate Tk.pm in @INC (@INC contains: C:/Perl/site/lib C:/Perl/ lib .) at -e line 1. BEGIN failed--compilation aborted at -e line 1. " ActivePerl: Build 1004 Perl: 5.10.0 On 19 mai, 15:30, Erik <zhengfen...@gmail.com> wrote: > Now I want to debug perl script thro...

compiling perl/tk widget (outside tk) on win32 ?
hi, i've got a problem, i have my external perl/tk widget, partially written in C it works well on linux when compiling, i'm using Tk::MMutil::TkExtMakefile to build make file; it somehow recognizes that i'm compiling the widget outside of Tk itself, at the end it produces Plotviewer.sl dynamic library when compiling on win32 (win xp, vc60), i get the same message when building makefile (that it recognized that i'm building the widget outside of Tk itself) but then it fails first problem is that it tries to create pTk.dll; not Plotviewer.dll; why ? second prob...

how to use to message widget in perl tk?
Could anyone give me a examples of using message/messagebox widget in unix? Here is the code that I wrote: my $subw = MainWindow ->new(); $top3=$subw->Frame(); $msg = $top3->Message(-text=>'message test', -background=>'red', -takefocus=>1); How can I see the message? Really appreciate your help. Vincent Vincent Lo wrote: > Could anyone give me a examples of using message/messagebox widget in unix? > > Here is the code that I wrote: > my $subw = MainWindow ->new(); > $top3=$subw->Frame(); $opt3->pack(); ...

Using a tk text widget for stdout
I am using a text widget as a substitute for the stdout of binary executables in Linux. e.g: if t is the tk text widget: $t insert end [exec ./dnaml < dnaml.setup] However, the whole output of dnaml to stdout is only appended within the widget after dnaml has completed execution. While dnaml is executing, no output appears in the widget. I need to see the output as it is produced, more or less as it would appear in a terminal window. Id there any way around this problem? Is the text widget perhaps inappropriate? I would greatly appreciate any advice. WillemF wrote: > I am using a te...

Index Value of a Button Widget in Perl/Tk
Hi, Can anyone point me how can I retrieve the index value or any value to indicate that a specific button is selected. Can anyone let me know how can I proceed with this. Actuall, based upon the selected button I want to pass the command to a specific subroutine for carrying out specific logic. But right now, any selected button will pass the control to the same subroutine Thanks, doni Here is the test code. #!/usr/bin/perl use strict; use Tk; my @received_hello; my @sending_rupd; my @changing_l2; my @received_nreg; my @received_nreg_new; my @sending_nreg_ack; my @received_nd; my @recei...

Perl Tk:Scheduler command called subroutine fails to talk to tk widgets
I'm using the CPAN Tk::Scheduler module to time control the execution of subroutines within my Perl script. I want to display the results of a scheduled task in a tk text widget. But, when my subroutine gets invoked by the scheduler via the -command switch, the called subroutine itself seems to be unable to talk to any Perl::Tk widgets; all such calls within the subroutine hang. Everything else seems to work ok. Does anyone know why? Do I have to call some sort of "refresh" tk command or release tk resources? use Tk; use Tk::Schedule; my $mw = MainWindow->new; my $s = ...

Linux Perl-TK -> Win32 Perl-Tk
I've got an app that I wrote in Perl-Tk for Linux (Redhat) that I would like to run on my Win32 laptop. I am not interested in dual-booting this laptop but would like to get the app up an running. I'm a perl-Tk hack at best. What is the best/easiest way to port the application? thanks, Mike On Tue, 21 Dec 2004 03:01:21 +0000, Michael Seningen wrote: > I've got an app that I wrote in Perl-Tk for Linux (Redhat) that I would > like to run on my Win32 laptop. > > I am not interested in dual-booting this laptop but would like to get > the ap...

Can't get passed 'use tk;' in my 1st perl/tk program.
I'm trying to run my 1st perl/tk program and can't get passed the "use Tk;" command. I get error, "Can't locate Tk.pm" and if I add a "use lib" pointer to directory containing Tk.pm, I get error message "Can't locate loadable object for module Tk::Event". SEE BELOW for actual scripts and error messages. Environment: Mac OS x 10.3.8; perl version 5.8.1; Tk directory Tk-804.027. Experince level: Used to write lots of perl code, 15 years ago on Sun/unix. Just wrote my 1st perl code on MAC. This is my first try at pe...

Bug in perl tk (Tk::Tree) ?
Hello, This simple script below... ------------------------------------------------------------ #!/usr/bin/perl -w use strict; use warnings; use Tk; use Tk::widgets qw/Tree ItemStyle/; my $mw = MainWindow->new(); $mw->fontCreate("MyFont", -family=> 'helvetica', -size => 9, -weight=>'medium'); my $t = $mw->Tree()->pack(); $t->ItemStyle('imagetext', -stylename => 'foobar', -activeforeground => '#ff0080', -font => 'MyFont', ); $t->add('root', -style => &...

Perl/Tk and Tk 8.5
Is there any word on when the enhancements in Tk 8.5 (Tiles, themes, better-looking widgets) will be made available in the Perl/Tk port? I know that ActiveState has made some of this available for awhile in the "Tkx" module, but I'm interested in cross-platform support and am wondering when 8.5 will be incorporated in the base "Tk" port module. [Cross-posted to comp.lang.perl.tk with follow-ups set to go there.] Steve wrote: > Is there any word on when the enhancements in Tk 8.5 (Tiles, themes, > better-looking widgets) will be made available in the P...

switching Tk::Text / Tk::ROText
Hi, thinking about Frank Kulows last posting, I was looking for a way to switch a Text widget from Text to ROText and backwards. Here is where I ended: It's still not really satisfactory, because both classes have to be initialized first (either by calling 'ClassInit' manually or by creating a 'dummy' instance). Also rebuilding the menu does not look very elegant. This is partial due to the way Tk::ROText changes the default 'Search' menu, deleting the 'Replace' entry after initialization instead of providing a Tk::ROText::SearchMenuItems metho...

tk text widget
Hi, See tk 4.2 file tkText.c: Tcl_AppendResult(interp, "bad switch \"", arg, "\": must be -forward, -backward, -exact, -regexp, ", "-nocase, -count, or --", (char *) NULL); return TCL_ERROR; ..... } else if ((c == 'f') && (strncmp(argv[i], "-forwards", length) == 0)) { backwards = 0; ..... hm , must be "-forward" , but writed "-forwards" also: tk 7.x tk 8.4.x tk 8.5.x ...... and see tk 8.6 file tkText.c: static const char *const switchStrings[] = { "--", "...

Perl/Tk Novice....Tk Error ...Help!
Hi, Does anynody know and understand the following Tk error - Possible precedence problem on bitwise ^ operator at .../blib/lib/Tk/Scale.pm (autosplit into .../blib/lib/auto/Tk/Scale/Increment.al) line 242. I'm trying to get a scale value when I click on the slider. Are there any simple examples of all the pre-ambles required to set up a slider on a canvas and capture the input from the user ? Any pointers would behighly appreciated. Thanks much in advance, Nash nrg@ornl.gov ...

Web resources about - uninitialized value using a Tk Text widget - comp.lang.perl.tk

Warnings, /sdl, and improving uninitialized variable detection
... developers prioritize which instances were the most likely to have security implications. The C4701 warning identifies potential usage of uninitialized ...

Uninitialized on Steam
Featured News Recommended Wishlist STATS "> STORE Home DISCUSSIONS Workshop Greenlight Market "> Community ABOUT SUPPORT Install Steam login ...

C Sharp (programming language) - Wikipedia, the free encyclopedia
(pronounced see sharp ) is a multi-paradigm programming language encompassing strong typing , imperative , declarative , functional , generic ...

Microsoft XML vulnerability under active exploitation
... a Security Advisory describing a vulnerability in the Microsoft XML component. We discovered this vulnerability—which is leveraged via an uninitialized ...

Windows driveby attack on aeronautical website may be state sponsored
... exploit was planted on the site by "cybercriminals" who first managed to compromise its security. The vulnerability, which stems from an uninitialized ...

McAfee Labs - Blog Central
#McAfeeFOCUS , #MFETrivia , #SecChat , #SecurityLegos , $1 million guarantee , .pre , 3DS , 3G , 12 Scams of Christmas , 99 things , 419 scam ...

Product Reviews - Make-Up - Women's Business Network and Lifestyle Magazine - DestinyConnect
23 June 2012 REGISTER - HELP - DESTINYMAN.COM - LEGAL - CONTACT US facebook twitter linkedin rss Editorial Social Search: DESTINY LOGO Home Business ...

Issues - chromium - An open-source browser project to help move the web forward. - Google Project Hosting ...
My favorites ▼ - Sign in chromium An open-source browser project to help move the web forward. Project Home Downloads Wiki Issues New issue Search ...

pcs hacks - Hack a Day
Pinball Stomp: Part 2 posted May 7th 2012 3:35pm by Caleb Kraft filed under: classic hacks , pcs hacks , peripherals hacks This is the 2nd and ...

Is String.IsNullOrEmpty Good or Bad?
I started to wonder about that when I was looking for an equivalent method in Ruby. Apparently, Ruby doesn’t come with such a method built-in, ...

Resources last updated: 2/2/2016 12:11:05 PM