Re: Gtk::Switch demo/example



2013-07-04 17:05, Giuseppe Penone skrev:
Hi,
I was not able to find any Gtk::Switch demo/example either in gtkmm-demo or in the gtkmm online manual. Since it's cute I would like to use it to replace my checkbuttons, could anybody point me to a couple of line of code that show how to connect to the status on/off change event?
Thanks,
Giuseppe.


Gtk::Switch does not seem to have a suitable signal to connect to, but it has property_active(). Each property has a signal_changed(). You should be able to do something like this:

void on_switch_changed();

m_switch1.property_active().signal_changed().connect(sigc::mem_fun(*this, &ExampleWindow::on_switch_changed));

Kjell



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