|
From: Pat T. <pa...@zs...> - 2004-09-18 13:12:12
|
Kevin Walzer <sw...@wo...> writes:
>-----BEGIN PGP SIGNED MESSAGE-----
>Hash: SHA1
>
>I'm having difficulty with the progress bar widget. I want to display
>the progress bar in a continuing loop to signify a process of indefinite
>length--the "barberpole" widget in Interface Builder serves this
>function, but since Tile doesn't have an equivalent version, looping the
>regular progress bar during the process (so that it repeats from 0-100
>until the process terminates) is my workaround.
I have no idea what the barberpole widget looks like -- maybe it's
something that can be achieved by redefining the TProgress.bar element
using the pixmap/image engine though.
>
>The problem I'm having is that the only place I've seen the progress bar
>used is in the Tile demo, and the way it's presented there--as begin
>attached/driven by the "scale" widget--isn't how I want to do it. Here's
>the code in the tile demo:
The progress bar widget has a get and a set subcommand which take the
value to set the progress bar too. For instance, if we define the
range of the widget as 0 - 100, then a [$progressbar set 50] will
cause the bar to fill half the widget.
eg:
pack [tprogress .p -from 0 -to 100]
.p set 50
If you want to read the value, either [.p get] or [.p cget -value]
will do it.
So to cycle:
proc every {ms body} {after $ms [info level 0]; eval $body}
proc Update {w interval} {
set v [expr {[$w get] + $interval}]
if {$v > [$w cget -to]} {
set v [$w cget -from]
}
$w set $v
}
every 250 {Update .p 10}
--
Pat Thoyts
PGP Fingerprint: 2C 6E 98 07 2C 59 C8 97 10 CE 11 E6 04 E0 B9 DD
|