Re: signal_timeout vs loops (changing label text continuously)



On Tue, 2006-27-06 at 08:41 -0500, Bob Caryl wrote:
> Anytime you create a "loop" in the GUI thread, all GUI operations 
> (including your call to Gtk::Label::set_text()) are suspended until your 
> loop finishes and the function in which it runs returns.  You must allow 
> Gtk::Main to do its job at some point during your loop iteration by 
> inserting the following statements:
> 
> while(Gtk::Main::events_pending())
>     Gtk::Main::iteration();
> 
> After your call to Gtk::Label::set_text().  This will allow the GUI to 
> update.  However, you should always avoid doing this sort of processing 
> in the GUI thread.  A well written application will do such processing 
> in a separate thread and use a Gtk::Dispatcher to update the GUI if 
> needed.  See  Gtk::Dispatcher 
> <http://www.gtkmm.org/docs/glibmm-2.4/docs/reference/html/classGlib_1_1Dispatcher.html>  
> for more information on how to do this.
> <http://www.gtkmm.org/docs/glibmm-2.4/docs/reference/html/classGlib_1_1Dispatcher.html> 

Thanks alot for your answer Bob. Also thanks to Leandro Fanzone.

You keep mentioning threads, but unfortunately I don't know anything
about them. Which book should I pick up?

Thanks,
-Gezim




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