[GtkD] How to connect to notify::active signal?

Mike Wey mike-wey at example.com
Sat May 4 02:59:06 PDT 2013


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


More information about the Digitalmars-d-learn mailing list