Name

BusyIndicator — Graphical busy indicator

Synopsis

BusyIndicator ( string label ,
  integer timeout );
 

Parameters

string label

the label describing the bar

Optional Arguments

integer timeout

the timeout in milliseconds until busy indicator changes to stalled state, 1000ms by default

Description

A busy indicator is a bar with a label that gives feedback to the user that a task is in progress and the user has to wait. It is similar to a progress bar. The difference is that a busy indicator can be used when the total number of steps is not known before the action starts. You have to send keep alive messages by setting alive to true every now and then, otherwise the busy indicator will change to stalled state.

There are some limitations due to technical reasons in ncurses ui: Only one BusyIndicator widget works at the same time. The BusyIndicator widget cannot be used together with an UserInput widget. Please use the TimeoutUserInput widget in a loop instead.

Usage

 	`BusyIndicator(`id(`busy), "background action", 2000 ),
 

Examples

          // Simple BusyIndicator example
{
    integer timeout = 3000;	// in milisenconds
    
    UI::OpenDialog(
		   `VBox(
			 `BusyIndicator(`id(`busy), "Sample busy indicator", timeout ),
			 `PushButton(`id(`alive), "send &tick"),
			 `Right(`PushButton(`id(`close), "&Close" ) )
			 )
		   );
 

    while ( true ) 
    {
	symbol button = (symbol) UI::TimeoutUserInput(100);

	if ( button == `alive )
	{
	    UI::ChangeWidget(`id(`busy), `Alive, true);
	}
	else if ( button == `close )
	    break;
    }
    
    UI::CloseDialog();
}