Blog Post #0099: A Special Request

Ferhat Kurtulmuş aferust at gmail.com
Thu Jan 23 14:10:37 UTC 2020


On Thursday, 23 January 2020 at 13:41:34 UTC, Ferhat Kurtulmuş 
wrote:
> On Thursday, 23 January 2020 at 12:32:57 UTC, Ron Tarrant wrote:
>> [...]
>
> Yes, but what if you set sensitive properties of a bunch of the 
> widgets in the same time. Each time you have to write and call 
> setSensitive() for each widgets. If you bind their sensitivity 
> property to one single widget, you can only switch one widget's 
> property, and others will set automatically.
>
> void doWhenDownloadIsComplete1(){// a lot of code pollution
>     but1.setSensitive(false);
>     but2.setSensitive(false);
>     .
>     .
>     entry2.setSensitive(false);
> }
>
> ...
>
> void doWhenDownloadIsComplete2(){ // nicer
>     but1.setSensitive(false);
>     // other widgets' sensitive properties are binded to of 
> but1. No extra code needed.
> }

Actually I have just tried this with gtkd and working:

button1.bindProperty("sensitive", entry1, "sensitive", 
GBindingFlags.DEFAULT);


More information about the Digitalmars-d-learn mailing list