hwtk::progressbar
Show the progress of an ongoing task.
Format
hwtk::progressbar - pathName ?option value? …
Description
A hwtk::progressbar widget is used to show the progress of an ongoing task. There are two types of progress bar. A determinate progress bar shows approximately how far a defined task has progressed by how much of the bar is filled. An indeterminate progress bar shows that the program is busy, but does not give an indication of how much of the given task has progressed.
Standard Options
- -clientdata
- Database name: clientData
- -cursor
- Database name: cursor
- -help
- Database name: help
- -helpcommand
- Database name: helpcommand
Widget-Specific Options
- -length
- Database name: length
- -mode
- Database name: mode
- -maximum
- Database name: maximum
- -orient
- Database name: orient
- -variable
- Database name: variable
- -value
- Database name: value
Widget Command
- pathName configure ?option? ?value option value …?
- Query or modify the configuration options of the widget. If one or more option-value pairs are specified, then the command modifies the given widget option(s) to have the given value(s); in this case the command returns an empty string. If option is specified with no value, then the command returns a list describing the named option: the elements of the list are the option name, database name, database class, default value, and current value. If no option is specified, returns a list describing all of the available options for pathName.
- pathName cget option
- Returns the current value of the configuration option given by option.
- pathName identify element x y
- Returns the name of the element under the point given by x and y, or an empty string if the point does not lie within any element. x and y are pixel coordinates relative to the widget. Some widgets accept other identify subcommands.
- pathName instate statespec ?script?
- Test the widget’s state. If script is not specified, returns 1 if the
widget state matches statespec and 0 otherwise. If script is specified,
equivalent to
if{[pathNameinstatestateSpec]}script
- pathName state ?stateSpec?
- Modify or inquire widget state. If stateSpec is
present, sets the widget state: for each flag in
stateSpec, sets the corresponding flag or clears it
if prefixed by an exclamation point. Returns a new state spec indicating
which flags were changed:
will restore pathName to the original state. If stateSpec is not specified, returns a list of the currently-enabled state flags.setchanges[pathNamestatespec]
pathNamestate$changes
- pathName start ?interval?
- Begin autoincrement mode: schedules a recurring timer event that calls step every interval milliseconds. If omitted, interval defaults to 50 milliseconds (20 steps/second).
- pathName step ?amount?
- Increments the progressbar indicator by amount. If omitted, amount defaults to 1.0.
- pathName stop
- Stop autoincrement mode: cancels any recurring timer event initiated by start.
Example
proc doBars {op args} {
foreach w $args {
$w $op
}
}
hwtk::dialog .dlg -title "::hwtk::progressbar"
set w [.dlg recess]
hwtk::frame $w.f
pack $w.f -fill both -expand 1
set w $w.f
label $w.11 -text "Determinate"
hwtk::progessbar $w.p1 -mode determinate
label $w.12 -text "Indeterminate"
hwtk::progessbar $w.p2 -mode indeterminate
hwtk::button $w.start -text "Start Progress" -command [list::hwtk::demo::doBars start $w.p1 $w.p2]
hwtk::button $w.stop -text "Stop Progress" -command [list::hwtk::demo::doBars stop $w.p1 $w.p2]
grid $w.11 - -pady 5 -padx 10
grid $w.p1 - -pady 5 -padx 10
grid $w.12 - -pady 5 -padx 10
grid $w.p2 - -pady 5 -padx 10
grid $w.start $w.stop - -pady 10 -padx 5
grid configure $w.start -sticky e
grid configure $w.stop -sticky w
grid columnconfigure $w all -weight 1
.dlg post