ProgressBar woes
Dean Arnold <[email protected]>
| Newsgroups | gmane.comp.lang.perl.tk |
|---|---|
| Message-ID | <[email protected]> |
I'm having some weird behavior w/ ProgressBar that I hope
someone can shed light on.
(WinXP, AS 5.8.3, Perl/TK 804.027 + patches)
My (rather large/complex) application is building many dialogs
and widgets at startup, and withdrawing them for later activation.
In this process, I attempt to embed a progress bar in a filesave
type dialog:
my $progress = 0;
$hw->Label(-text => 'Save Progress:',
-font => $style->{_labelfont})
->grid(-column => 0, -row => 6, -sticky => 'e');
my $pframe = $hw->Frame()->grid(-column => 1, -columnspan => 4, -row =>
6, -sticky => 'w');
$obj->{_progress_bar} = $pframe->ProgressBar(
-troughcolor => 'white',
-colors => [ 0, 'blue' ],
-anchor => 'w',
-gap => 2,
-width => 20,
-length => 200,
-relief => 'sunken',
-variable => \$progress
)
->pack(-fill => 'x', -expand => 1);
Note that the enclosing dialog uses a grid layout, but when I attempted
to grid() the progressbar, it appeared as a very large square, rather
than the explicitly specified length/width; when I added a Frame and
pack()'d the bar into it, it appears OK.
However, when the progress bar is created, its choking on the -variable
with the following msg:
DB<1> c
Can't set -variable to `SCALAR(0x59fd4e4)' for
Tk::ProgressBar=HASH(0x5b72110):
Bizarre copy of ARRAY in leave at C:/Perl/site/lib/Tk/Trace.pm line 89.
at C:/Perl/site/lib/Tk/Derived.pm line 294
at C:/Perl/site/lib/Tk/Derived.pm line 306
error:Bizarre copy of ARRAY in leave at C:/Perl/site/lib/Tk/Trace.pm
line 89.
I've stepped thru the variable() method, but can't understand whats
causing Tk to bark.
So I removed the -variable spec, and used explicit ->value() calls
to set the value, and things startup OK. But when the application
exits, I get a similar error in the ProgressBar::Destroyed()
method, since it appears to expect the -variable to have been defined,
and doesn't check for its existance before calling
$c->traceVdelete($var). When I added a test for existance, ie,
$c->traceVdelete($var) if defined($var);
then it exits quietly.
Note that I've copied the example from MPTK and run it wo/ problems.
So my questions:
1. Is -variable a required parameter ? It doesn't appear to be,
assuming I use either configure(-value), or the value() method.
2. Is there a current set of patches for ProgressBar that address some
of these issues ? Google didn't turn anything up wrt 804.027.
3. Any ideas wrt the odd sizing behavior inside a grid ?
TIA,
Dean Arnold
Presicient Corp.
-++**==--++**==--++**==--++**==--++**==--++**==--++**==
This message was posted through the Stanford campus mailing list
server. If you wish to unsubscribe from this mailing list, send the
message body of "unsubscribe ptk" to [email protected]