Next: ANSIScrollingListBoxPane, Previous: ANSIMessageBoxPane, Up: Classes [Index]
ANSIProgressBarPane
ClassAn ANSIProgressBarPane
object displays a horizontal progress
bar on a serial terminal or xterm. If you display a progress bar pane
independently (using the show
method), you can close the pane by
pressing Enter or Esc.
The ‘progress’ instance variable specifies how much of the
progress bar is highlighted. It’s better to use the percent
method, though, which calculates the progress bar’s hightlighted area
and sets the percent legend.
As with all other ANSI pane widgets, you either display or omit the
border and shadow decorations. Progress bars can also display a
title string, which you can set using the title
method, implemented
in ANSIWidgetPane
class. See ANSIWidgetPane.
Here is an example program that displays an ANSIProgressBarPane
object.
int main () { ANSIProgressBarPane new progressBar; progressBar shadow = 1; progressBar border = 1; progressBar title "Progress"; progressBar percent 65.0; progressBar show 2, 2; progressBar cleanup; }
You can set the size of a progres bar using the dimension
method.
In that case, setting the progress bar using the percent
method
adjusts for the pane’s width. The widget’s display area is always drawn
as one character row tall, however.
If you display the progress bar as a widget in an application, then
you can update the progress bar on the screen using the display
method instead of show
, because display
does not wait for
user input before returning.
pctLabelMargin
An Integer
that specifies where to draw the percent legend
in the progress bar’s content area.
percentInt
An Integer
that specifies percent of the progress bar’s
internal area that is highlighted. Setting this using the
percent
method, below, also adjusts the hightlight’s dimensions
for the progress bar’s width. This variable is also used to display
the text of the percent logo in the widget’s content area.
progress
An Integer
that specifies the number of character columns to
highlight in the progress bar’s viewable area.
viewHeight
An Integer
that specifies the height in character rows of
the widget’s viewable area. The progress bar highlight is always
drawn as one character row in height.
viewWidth
An Integer
that specifies the width in character rows of the
widget’s viewable area.
dimension
(Integer
width, Integer
height)
Set the width and height of the pane in character columns.
show
(Integer
x, Integer
y)
Display the pane at row and column x,y, and return immediately.
handleInput
(void
)
Wait for the user’s input. Pressing Esc or Enter closes the pane. and returns.
new
(String
paneName)
Create new ANSIProgressBarPane
objects, one for each label
given in the method’s argument list.
percent
(Float
percent)
Set the percent of the progress bar’s highlighted area. This method adjusts for the width of the progress bar and sets the text for the percent logo.
refresh
(void
)
Redraw the progress bar on the terminal.
show
(Integer
x, Integer
y)
Display the pane at row and column x,y, and wait for the user’s input.
Next: ANSIScrollingListBoxPane, Previous: ANSIMessageBoxPane, Up: Classes [Index]