Re: gtkmm 3.4.0 - Gtk::Switch where is the signal "activate"?



On 20/06/2012 01:27, Kjell Ahlstedt wrote:
> 2012-06-19 18:00, Giuseppe Penone skrev:
>> Hi,
>> I would like to use the signal "activate" of the widget Gtk::Switch (which I
>> discovered through glade signals tab),
>> I see that it exists in gtk 3.2:
>> http://developer.gnome.org/gtk3/3.2/GtkSwitch.html#GtkSwitch-activate
>> but it is not mentioned on
>> http://developer.gnome.org/gtkmm/stable/classGtk_1_1Switch.html
>> and the "m_switch.signal_activate()" causes error at compilation time.
>> Cheers,
>> Giuseppe.
>>
> The description of GtkSwitch-activate that you link to says "Applications should
> never connect to this signal, but use the notify::active signal." That's why
> this signal is not wrapped in gtkmm. I wonder if it's really a good thing that
> it appears in glade.
> 
> It's not obvious how to connect to the notify::active signal from a C++ program.
> I think this how to do it:
> 
> void MyWidget::on_switch_active_changed();
> m_switch.property_active().signal_changed().connect(sigc::mem_fun(*this,
> &MyWidget::on_switch_active_changed));
> 
> I admit that it looks complicated. Does anyone know an easier way?

Short of using C++11 lambdas, I don't think there is an easier way.

-- 
Kind regards,
Loong Jin

Attachment: signature.asc
Description: OpenPGP digital signature



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