Re: [gtkmm] Update graphical interface in loop;



Rogério Samuel de Moura Martins wrote:

I create a loop:

   for(int i = 0; i < 100; ++i) {
      m_Label.setLabel((string)i);
   }

but the interface not update in looping.
what commnad insert to udpdate inteface?

   for(int i = 0; i < 100; ++i) {
      m_Label.setLabel((string)i);
      //>>> command for update interface;
   }

Remember that your code executes when gtkmm calls your event handlers, not the other way around. Under normal circumstances, state changes to widgets will not cause screen updates until your event handler returns control to gtkmm. You can give gtkmm a chance to execute by inserting

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

into your loop.

Cheers,
Tim



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