GTKD - CSS class color "flash" delay
TheDGuy via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri Jun 24 05:38:37 PDT 2016
Hello,
i would like to flash some buttons with CSS. My current approach:
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");
writeln(CSSClassName);
//some kind of delay
currentButton.getStyleContext().removeClass(CSSClassName ~
"-flash");
}
The color changing part works fine but if i use some kind of
delay the program just starts delayed but no color changing
happens. I am wondering why, because everything is executed in
one thread, so the execution order looks like this to me:
1. Start GUI
2. Change Button Color to flash color
3. Wait 2 sec
4. Change Button Color back to standard
but instead it looks like this:
1. Wait 2 sec
2. Start GUI
3. Change Button Color to flash color
4. Change Button Color back to standard
Now because a delay is missing the change between the colors
happens unnoticeable fast.
I hope i can get around it without getting into multithreading?
More information about the Digitalmars-d-learn
mailing list