Re: Disconnecting signals and connection control
- From: Kjell Ahlstedt <kjell ahlstedt bredband net>
- To: eypros <eypros gmail com>
- Cc: gtkmm-list gnome org
- Subject: Re: Disconnecting signals and connection control
- Date: Fri, 21 Oct 2011 16:50:33 +0200
mån 2011-10-17 klockan 08:41 -0700 skrev eypros:
> Anyway it works up to a point. The problem is that instead of getting the
> value of SpinButton as an argument for signal_timeout connection it just
> increases the speed. This makes me think that maybe I install new connection
> with each SpinButton button press so they all work simultaneously and there
> explained the speed increase?
You guessed it! That's what happens.
> So if this is the catch how do I disconnect signal_timeout?
Save the connection that is returned from
Glib::signal_timeout().connect() and use disconnect().
In Spin::Spin:
// m_connection is a sigc::connection.
m_connection = Glib::signal_timeout().connect(sigc::mem_fun(*this,
&Spin::on_timeout), m_Spin.get_value_as_int());
....
void Spin::on_spinbutton_digits_changed()
{
m_connection.disconnect();
m_connection = Glib::signal_timeout().connect(sigc::mem_fun(*this,
&Spin::on_timeout), m_Spin.get_value_as_int());
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]