Re: Update progress bar without returning to main loop?



Paul Davis wrote:

No time to explain. I'm running late.

Here it is.  Use threads.  Email questions.

It's a very simple app, the complexity of threads has no place in it. Especially if it's just to make the GUI behave. In fact, introducing threads just for this seems very wrong for any program...


Good luck.

Toralf Lund wrote:

I have what I believe is a classic issue with progress bars, but I have never found a good solution in the docs or via a web search:

I'm trying to indicate progress of a signal handler that takes a *long* time via a Gtk::ProgressBar and multiple calls (as the work progresses) using the set_fraction() method. The problem is that these calls have no real effect, since the actual GUI update isn't done until after the application returns to the main loop (i.e. when the handler is done and the progress has reached 100%). The only way I've found to ensure it's redrawn as the work progresses, is to flush events using something like:

while(Gtk::Main::events_pending())
  Gtk::Main::iteration(false);

But this has some nasty side effects. In particular, it means that user input like button clicks, text field updates also handled, which is not what I want; I need the window to be unresponsive while the above mentioned callback is being executed.

Is there an alternative?

- Toralf



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







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