ProgressBar and error handling



Title: ProgressBar and error handling

Hi All

I have this ProgressBar Window which is running a task and updates itself(using set_fraction) and it uses signal_timeout()(and onTimeOut() callback) method. During this backend processing before updating itself,if it encounters an error, it should show another window with the error msg. On clicking continue on the error message, the task should continue its progress and the progress bar should show progress from where it left.

I am able to continue running the task at the back end but how to continue the progress bar's progress from where I left? say it encountered an error at 24% and on clicking continue, the progress should proceed from 24%

Any ideas on how to achieve this?

Thanks a ton in advance
Sirisha

Code Snippet
-------------

class CProgressBar : public Gtk::Window {

public:
bool onTimeOut();

}

CProgressBar {
//someother initializations and logic
Glib::signal_timeout().connect( sigc::mem_fun(*this, &CGProgressBar::onTimeout), 500 );
}

bool CProgressBar::onTimeOut() {

//update the progress bar using set_fraction
//and wait for error to happen in the backend

   if(error) {
    this->hide();
    //pass the CProgressBar reference to CErrorWindow object
    CErrorWindow *error = new CErrorWindow(*this);
    Gtk::Main::run(*error);
    present();
    return false;
   }
return true;
}//end of method




int main() {

CProgressBar *pg = new CProgressBar();
Gtk::Main::run(*pg);
present();
}


In CErrorWindow, there are 2 button "CONTINUE" and "CANCEL"

clicking on continue should take you back to CProgressBar and resume from where it left.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]