Blog Post #0099: A Special Request

Ferhat Kurtulmuş aferust at gmail.com
Thu Jan 23 13:41:34 UTC 2020


On Thursday, 23 January 2020 at 12:32:57 UTC, Ron Tarrant wrote:
> On Thursday, 23 January 2020 at 09:27:45 UTC, Ferhat Kurtulmuş 
> wrote:
>
>> I want this button disabled so that user cannot spawn another 
>> thread while the first one is on duty.
>
> This is actually the subject of an up-coming post which is 
> scheduled to go live on Feb. 25, 2020. It uses setSensitive() 
> rather than bindProperty(), but it has the same effect.

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.
}


More information about the Digitalmars-d-learn mailing list