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



Mirco,

You can disable the time-out callback at any time by having it return false,
instead of true.  Once you do this, it will not be called again.  To re-activate
the callback, you would probably need to re-connect it using the technique
you've been described in the previous two posts.


Regards,

Nickolai



On Thu, Sep 29, 2005 at 05:05:07PM +0200, Mirco MacSlow M?ller wrote:
> 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??ller <macslow bangang de>
> 
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtkmm-list



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