Rolle
Rolle

Reputation: 2980

gtkmm: update gui from other thread?

I am using gtkmm (and glibmm), and I would like to update the GUI from another thread. I have followed the example on

http://www.gtkmm.org/docs/glibmm-2.4/docs/reference/html/thread_2dispatcher_8cc-example.html#_a1

but I have 2 questions:

THanks!

Upvotes: 0

Views: 2007

Answers (1)

Soo Wei Tan
Soo Wei Tan

Reputation: 3371

You could have your Glib::MainLoop receive the events, then dispatch it to Gtk::Main.

I believe the only way to connect with custom arguments is to use sigc::bind.

For example, say you wanted to pass in an integer, as well as a pointer to the widget in question:

pWidget->signal_foo().connect( 
            sigc::bind<int, Gtk::SomeWidget*>( 
                sigc::mem_fun( *this, &Bar::OnFooBar ), i, pWidget ) );  

Upvotes: 1

Related Questions