[prev in list] [next in list] [prev in thread] [next in thread]
List: gtkmm
Subject: Re: Disconnecting signals and connection control
From: Kjell Ahlstedt <kjell.ahlstedt () bredband ! net>
Date: 2011-10-21 14:50:33
Message-ID: 1319208633.2115.6.camel () kjell-desktop
[Download RAW message or body]
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());
}
_______________________________________________
gtkmm-list mailing list
gtkmm-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtkmm-list
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic