Re: [gtkmm] progress bar



Am 2003.09.16 20:45 schrieb(en) Mani Murugesan:
Hello,
When I do a long computation inside a button clicked method, the
progress bar
does not get updated when I call its pulse() method from within the
computation. For example:

void somedialog::on_some_btn_clicked()
{
  for (int i=0; i<50; i++)
  {
    for (int j=0; j<60000; j++)
      for (int k=0; k<1000; k++)
        ; // dummy loop waste some time here

    cout << "Test: " << endl;
    progressbar->pulse(); // this does not update the progress bar
  }
}

Anything else I have to do?

progessbar->pulse() queues a redraw event that doesn't get processed
until the next iteration of the main loop.
I would try to add Gtk::MainContext::get_default()->iteration(false);
after progressbar->pulse() but I'm not sure if this is correct.

Regards,

  Martin



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