Re: ProgressBar and error handling



On 2/26/07, Sirisha Muppavarapu <sirisha muppavarapu veralight com> wrote:




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

When you come back into onTimeOut, this logic should figure out where
to start from. You can get the current progress bar value with
get_fraction() IIRC.

 //and wait for error to happen in the backend

    if(error) {
     this->hide();
     //pass the CProgressBar reference to CErrorWindow object

Is there a reason you're passing the progress bar to the error dialog?


     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.


_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
http://mail.gnome.org/mailman/listinfo/gtkmm-list



You should just be able to call back to onTimeOut unless I'm missing
something important.  The progress bar will know what fraction its at,
but its your job to tell it how to update, which includes continuing
from 25% or what not.

HTH,
Paul Davis



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