On Saturday, 25 June 2016 at 20:39:53 UTC, Mike Wey wrote:

The constructor accepts an delegate, witch can access it's context so it has access to some of the data.

The functions from GTK are also available like Timeout.add from the linked tutorial: http://api.gtkd.org/src/glib/Timeout.html#Timeout.add


You may want to do something like this:

```
private void letButtonsFlash()
{
    foreach(Button btn;bArr){
        btn.setSensitive(false);
    }

    Timeout t = new Timeout(&timeout_delay,5,false);
}

private 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().addClass(CSSClassName ~ "-flash");
    }

    return false;
}

```

Thanks a lot for your answer, i tried it like this and it works:

    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);

        foreach(Button btn;bArr){
            btn.setSensitive(true);
        }
    }
    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");
        }
        return false;
    }

But i want to flash (e.g. change the CSS class) the buttons one by one and not all at the sime time? How am i going to do that?

Reply via email to