GTKD - CSS class color "flash" delay

TheDGuy via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Jun 26 14:06:58 PDT 2016


On Sunday, 26 June 2016 at 16:29:52 UTC, Mike Wey wrote:
>
> How about this:
>
> private void letButtonsFlash(){
>     foreach(Button btn;bArr){
>         btn.setSensitive(false);
>     }
>     for(int i = 0; i < level; i++){
>         Button currentButton = bArr[rndButtonBlink[i]];
>         ListG list = 
> currentButton.getStyleContext().listClasses();
>         string CSSClassName = 
> to!string(cast(char*)list.next().data);
>         currentButton.getStyleContext().addClass(CSSClassName ~ 
> "-flash");
>     }
>     Timeout t = new Timeout(&timeout_delay,1,false);
> }
>
> bool timeout_delay(){
>     for(int i = 0; i < level; i++){
>         Button currentButton = bArr[rndButtonBlink[i]];
>         ListG list = 
> currentButton.getStyleContext().listClasses();
>         string CSSClassName = 
> to!string(cast(char*)list.next().data);
>         
> currentButton.getStyleContext().removeClass(CSSClassName ~ 
> "-flash");
>     }
>     foreach(Button btn;bArr){
>         btn.setSensitive(true);
>     }
>     return false;
> }
>
> Sets all the buttons to the flash color and after an timeout 
> removes the flash color from all the buttons.

Thanks for your answer,

but as i said before, i want to flash each button on it's own 
(the game is kinda like 'Simon Says').


More information about the Digitalmars-d-learn mailing list