|
YCP UI Widget Reference
Back to the widget index
|
ProgressBar
|
Graphical progress indicator
|
|
Description
A progress bar is a horizontal bar with a label that shows a progress
value. If you omit the optional parameter maxvalue, the maximum
value will be 100. If you omit the optional parameter progress, the
progress bar will set to 0 initially.
Arguments
|
string
|
label
|
the label describing the bar
|
Optional
|
integer
|
maxvalue
|
the maximum value of the bar
|
|
integer
|
progress
|
the current progress value of the bar
|
Special Properties
|
integer
|
Value
|
the current progress
|
|
string
|
Label
|
the label above the progress bar
|
Sample Usage
`ProgressBar(`id(`pb), "17 of 42 Packages installed", 42, 17)
Examples
UI(``{
OpenDialog(
`VBox(
`ProgressBar(`id(`pr), "This is a progressbar", 4, 0), // 4 steps
`PushButton("Next")
)
);
integer prog = 0;
while (prog < 4)
{
UserInput();
prog = prog + 1;
ChangeWidget(`id(`pr), `Value, prog);
ChangeWidget(`id(`pr), `Label, sformat("Progress %1 out of 4", prog));
}
CloseDialog();
})
|
UI(``{
OpenDialog(
`VBox(
`Heading("Adjust the volume"),
`ProgressBar(`id(`vol), "Volume", 100, 50),
`HBox(
`PushButton(`id(-5), "<<"),
`PushButton(`id( 5), ">>")
)
)
);
any ret = nil;
while (true) {
ret = UserInput();
if (ret == `cancel) break;
else {
integer old_volume = QueryWidget(`id(`vol), `Value);
y2debug(old_volume);
ChangeWidget(`id(`vol), `Value, old_volume + ret);
}
}
CloseDialog();
})
|
Back to the widget index
|