Q: How do I enable/disable a timed callback during runtime?



Greetings everybody!

	So far I've failed to figure out form the gtkmm-docs and the supplied
example sources how to properly add a callback-function that gets
executed "once in a while".

	I want to be able to enable/disable a timed callback during runtime.
What I found in the docs is a Glib::SignalTimeout. I used the supplied
example to do something like this:

	timeout_source = Glib::TimeoutSource::create (100);
	timeout_source->connect(sigc::ptr_fun (&on_timeout));
	timeout_source->attach(Glib::MainContext::get_default ());

	But how is this connection arbitrarily enabled/disabled during
run-time? The user should be able to control that via a simple
Gtk::ToggleButton. So how can I "detach"/"reattach" my timout-handler
on_timeout() at run-time?

Thanks in advance for your time and kind advice!

Best regards...

MacSlow

-- 
Mirco "MacSlow" M�<macslow bangang de>




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