www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - [GtkD] How to connect to notify::active signal?

reply Alexandr Druzhinin <drug2004 bk.ru> writes:
I need to connect to "notify::active" signal for Switch widget to 
process changing of its state. The guides say I shouldn't use onActivate 
signal, but "notify:active". But I didn't find a way to do it. Can 
somebody help with it?
May 03 2013
parent reply Mike Wey <mike-wey example.com> writes:
On 05/03/2013 06:30 PM, Alexandr Druzhinin wrote:
 I need to connect to "notify::active" signal for Switch widget to
 process changing of its state. The guides say I shouldn't use onActivate
 signal, but "notify:active". But I didn't find a way to do it. Can
 somebody help with it?
Are you referring to gtk.Switch ? -- Mike Wey
May 03 2013
parent reply Alexandr Druzhinin <drug2004 bk.ru> writes:
04.05.2013 1:18, Mike Wey пишет:
 On 05/03/2013 06:30 PM, Alexandr Druzhinin wrote:
 I need to connect to "notify::active" signal for Switch widget to
 process changing of its state. The guides say I shouldn't use onActivate
 signal, but "notify:active". But I didn't find a way to do it. Can
 somebody help with it?
Are you referring to gtk.Switch ?
yes, gtk.Switch if I connect to activate signal by means addOnActivate nothing works. Documentation says I should use "notify::active" event (it belongs to ObjectG, as I understand?), but I cannot find a way to connect to this signal by means of GtkD.
May 03 2013
parent Mike Wey <mike-wey example.com> writes:
On 05/04/2013 05:20 AM, Alexandr Druzhinin wrote:
 04.05.2013 1:18, Mike Wey пишет:
 On 05/03/2013 06:30 PM, Alexandr Druzhinin wrote:
 I need to connect to "notify::active" signal for Switch widget to
 process changing of its state. The guides say I shouldn't use onActivate
 signal, but "notify:active". But I didn't find a way to do it. Can
 somebody help with it?
Are you referring to gtk.Switch ?
yes, gtk.Switch if I connect to activate signal by means addOnActivate nothing works. Documentation says I should use "notify::active" event (it belongs to ObjectG, as I understand?), but I cannot find a way to connect to this signal by means of GtkD.
You can use addOnNotify it currently doesn't allow you to specify the property for witch you want to receive the signal (it probably should). For now you could do: Switch sw = new Switch(); sw.addOnNotify(&notify); void notify(ParamSpec param, ObjectG obj) { if(param.getName() == "active") { //Do stuff } } -- Mike Wey
May 04 2013