Banana.Application.ProgressBar

该文档是已过时的旧文档

The most complete and up-to-date documentation is the one of Banana Accounting Plus: Try it now

In this article

Banana.Application.ProgressBar is the interface to the program progress bar and can be accessed through Banana.application.progressBar. The progressBar object is used to give the user an indication of the progress of an operation and the possibility to interrupt the running process. The progress bar is showed in bottom left corner of the application windows.

Methods

finish()

Notify that the operation has been completed and close the progress bar.

progressBar.finish();

pause()

Notify that the operation has been paused, the cursor icon is set to the arrow cursor or poiting hand cursor. This is usually called before showing a dialog.

Banana.application.progressBar.pause();
var result = dialog.exec();
Banana.application.progressBar.resume();

resume()

Notify that the operation has been resumed, the cursor icon is set back to an hourglass or watch cursor. This is usually called after a dialog has been closed.

Banana.application.progressBar.pause();
var result = dialog.exec();
Banana.application.progressBar.resume();

start(maxSteps)

Start the progress indicator and define the number of steps this operation needs before being complete.

You can call several times this method to split the progress in main and sub steps. Every call of the method start() should be paired with a call of the method finish().

// Example use of a progress bar
var progressBar = Banana.application.progressBar;
progressBar.start(10);   
for (var i = 0; i < 10; i++) {
    ...
    if (!progressBar.step(1)) {
       return; // Operation canceled by the user
    }
}
progressBar.finish();           

step([stepCount])

Advance the progress indicator of stepCount steps. If stepCount is not defined it advance of one step.

Returns false if the user canceled the operation, otherwise true.

progressBar.step(1);

Example multiple steps inside a block

// Two blocks of progress bar inside a progressBar

var progressBar = Banana.application.progressBar;

progressBar.start(2);           

// Block 1
progressBar.start(10)     
for (i=0;i < 10; i++) {
     progressBar.step(1);
}
progressBar.finish();       

// Block 2
progressBar.start(10)     
for (i=0;i < 10; i++) {
     progressBar.step(1);
}
progressBar.finish();           

progressBar.finish();         

 

 

Share this article: Twitter | Facebook | LinkedIn | Email