Re: Update progress bar without returning to main loop?




AFAIK in order for the gui to update, Gtk must regain control to paint its widgets. Now to get a gui updating while processing some application routine, you can either A: pass control back and forth to Gtk, or B: do both things simultaneously.

Now if you're completely dead set on not using threads ( which I really do not understand ), you can leverage the idle loop call back to do your processing.

This requires you to be able to write your processing in some form of reentrant alogorithm. e.g. If you we're writing some large file to disk, you could use a non blocking file descriptor and track the number of bytes written. Which seems silly. But to each their own.

Good luck.

Paul

Armin Burgmeier wrote:

Here it is.  Use threads.  Email questions.


Using threads, you would have the same problem as with calling Gtk::Main::iteration() periodically: The GUI remains fully responsive.

What about disabling any widgets you don't want the user to interact with during your calculation via Gtk::Widget::set_sensitive()? The Window as such remains responsive to the operating system (e.g. Windows would not say that it "does not react" anymore) and the user cannot click any buttons. Additionally, the user has some more feedback that tells him that there is a calculation going on and he currently cannot interact with the application.

 - Armin
_______________________________________________
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]