Re: Update progress bar without returning to main loop?



Paul Davis wrote:


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 ),

No, I'm not dead set on not using thread as such. I just think it's wrong to introduce parallel operation in the manner discussed here, when I specifically want the application to have a *sequential* behaviour.

As it turns out, there is a very simple way of resolving all this. All I have to do, is to say

progress->get_window()->process_updates(false);

every once in a while.
<http://www.gtkmm.org/docs/gtkmm-2.4/docs/reference/html/classGdk_1_1Window.html#a54>
So no, you do not have to pass control back to Gtk to get updates. Yes, it does queue up draw requests for efficiency purposes, but of course there is a simple call to flush the queue! I was starting to doubt if there was such a call, which I must admit gave me some doubts about the whole Gtk design at the same time, but then someone pointed me in the right direction.


- Toralf




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