www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - GTKD - CSS class color "flash" delay

reply TheDGuy <a.b gmail.de> writes:
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?
Jun 24 2016
parent reply Gerald <gerald.b.nunn gmail.com> writes:
On Friday, 24 June 2016 at 12:38:37 UTC, TheDGuy wrote:
 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
Everything in GTK runs in the same thread, if your delay is a blocking one (i.e. putting the thread to sleep for 2 seconds) none of the GTK events will fire to redraw the button since the thread is occupied with your delay.
 I hope i can get around it without getting into multithreading?
Other then the obvious multi-threaded, using glib.Timeout to trigger the reversion of the color change could be an option. http://api.gtkd.org/src/glib/Timeout.html
Jun 24 2016
parent reply TheDGuy <a.b gmail.de> writes:
On Friday, 24 June 2016 at 16:44:59 UTC, Gerald wrote:
 Other then the obvious multi-threaded, using glib.Timeout to 
 trigger the reversion of the color change could be an option.

 http://api.gtkd.org/src/glib/Timeout.html
Thanks! I tried this so far: 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"); writeln(CSSClassName); Timeout t = new Timeout(&timeout_delay,1,true); currentButton.getStyleContext().removeClass(CSSClassName ~ "-flash"); } foreach(Button btn;bArr){ btn.setSensitive(true); } } bool timeout_delay(){ Thread.sleep(dur!("seconds")(5)); return false; } and it is "working" to the extend that at least the CSSClassName gets written in the console but the UI again just pops up after 5 sec. Could you give me a tip?
Jun 24 2016
parent reply Mike Wey <mike-wey example.com> writes:
On 06/24/2016 10:03 PM, TheDGuy wrote:
 On Friday, 24 June 2016 at 16:44:59 UTC, Gerald wrote:
 Other then the obvious multi-threaded, using glib.Timeout to trigger
 the reversion of the color change could be an option.

 http://api.gtkd.org/src/glib/Timeout.html
Thanks! I tried this so far: 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"); writeln(CSSClassName); Timeout t = new Timeout(&timeout_delay,1,true); currentButton.getStyleContext().removeClass(CSSClassName ~ "-flash"); } foreach(Button btn;bArr){ btn.setSensitive(true); } } bool timeout_delay(){ Thread.sleep(dur!("seconds")(5)); return false; } and it is "working" to the extend that at least the CSSClassName gets written in the console but the UI again just pops up after 5 sec. Could you give me a tip?
You should change the css class in the timeout_delay function. It's called by the GTK main loop every time the amount of seconds passed to the constructor has passed. And return true if you want to continue to flash the button, and false to stop. Also don't sleep in the timeout function, the main loop should take care of that, currently you are blocking the main thread for 5 seconds. -- Mike Wey
Jun 25 2016
parent reply TheDGuy <a.b gmail.de> writes:
On Saturday, 25 June 2016 at 11:45:40 UTC, Mike Wey wrote:
 You should change the css class in the timeout_delay function.

 It's called by the GTK main loop every time the amount of 
 seconds passed to the constructor has passed. And return true 
 if you want to continue to flash the button, and false to stop.

 Also don't sleep in the timeout function, the main loop should 
 take care of that, currently you are blocking the main thread 
 for 5 seconds.
Thanks for your answer. I have to pass the Button object to my timeout function to change the CSS class. But how do i do that within the Timeout constructor?
Jun 25 2016
parent reply TheDGuy <a.b gmail.de> writes:
On Saturday, 25 June 2016 at 13:01:09 UTC, TheDGuy wrote:
 Thanks for your answer.
 I have to pass the Button object to my timeout function to 
 change the CSS class. But how do i do that within the Timeout 
 constructor?
I mean: I have to pass my function and delay time to the constructor, but i can't pass any data to the function here, also only functions are allowed (at least it looks like that to me) who don't have parameters. If i want to add a new function i have to use the function .add(), with this function i can pass 'userData' (so my button for example). But why am i unable to do that in the constructor? Do i have 2 different functions for the same thing, one with the other one without parameter? My current approach: 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"); //writeln(CSSClassName); Timeout t = new Timeout(&timeout_delay,5,false); //error appears here t.add(5,&timeout_delay,currentButton); } foreach(Button btn;bArr){ btn.setSensitive(true); } } bool timeout_delay(Button currentButton){ ListG list = currentButton.getStyleContext().listClasses(); string CSSClassName = to!string(cast(char*)list.next().data); currentButton.getStyleContext().removeClass(CSSClassName ~ "-flash"); return false; } But i get the error: Error: none of the overloads of '__ctor' are callable using argument types (bool delegate(void* userData), int, bool), candidates are: glib.Timeout.Timeout.this(uint interval, bool delegate() dlg, bool fireNow = false) glib.Timeout.Timeout.this(uint interval, bool delegate() dlg, GPriority priority, bool fireNow = false) glib.Timeout.Timeout.this(bool delegate() dlg, uint seconds, bool fireNow = false) glib.Timeout.Timeout.this(bool delegate() dlg, uint seconds, GPriority priority, bool fireNow = false) If i take a look at GTK for C it looks like there is a function for that: http://www.gtk.org/tutorial1.2/gtk_tut-17.html Why is this so confusing?
Jun 25 2016
next sibling parent TheDGuy <a.b gmail.de> writes:
On Saturday, 25 June 2016 at 15:26:00 UTC, TheDGuy wrote: }
 But i get the error:
 Error: none of the overloads of '__ctor' are callable using 
 argument types (bool delegate(void* userData), int, bool), 
 candidates are:
This is the correct error message: Error: none of the overloads of '__ctor' are callable using argument types (bool delegate(Button currentButton), int, bool), candidates are:
Jun 25 2016
prev sibling parent reply Mike Wey <mike-wey example.com> writes:
On 06/25/2016 05:26 PM, TheDGuy wrote:
 On Saturday, 25 June 2016 at 13:01:09 UTC, TheDGuy wrote:
 Thanks for your answer.
 I have to pass the Button object to my timeout function to change the
 CSS class. But how do i do that within the Timeout constructor?
I mean: I have to pass my function and delay time to the constructor, but i can't pass any data to the function here, also only functions are allowed (at least it looks like that to me) who don't have parameters. If i want to add a new function i have to use the function .add(), with this function i can pass 'userData' (so my button for example). But why am i unable to do that in the constructor? Do i have 2 different functions for the same thing, one with the other one without parameter? My current approach: 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"); //writeln(CSSClassName); Timeout t = new Timeout(&timeout_delay,5,false); //error appears here t.add(5,&timeout_delay,currentButton); } foreach(Button btn;bArr){ btn.setSensitive(true); } } bool timeout_delay(Button currentButton){ ListG list = currentButton.getStyleContext().listClasses(); string CSSClassName = to!string(cast(char*)list.next().data); currentButton.getStyleContext().removeClass(CSSClassName ~ "-flash"); return false; } But i get the error: Error: none of the overloads of '__ctor' are callable using argument types (bool delegate(void* userData), int, bool), candidates are: glib.Timeout.Timeout.this(uint interval, bool delegate() dlg, bool fireNow = false) glib.Timeout.Timeout.this(uint interval, bool delegate() dlg, GPriority priority, bool fireNow = false) glib.Timeout.Timeout.this(bool delegate() dlg, uint seconds, bool fireNow = false) glib.Timeout.Timeout.this(bool delegate() dlg, uint seconds, GPriority priority, bool fireNow = false) If i take a look at GTK for C it looks like there is a function for that: http://www.gtk.org/tutorial1.2/gtk_tut-17.html Why is this so confusing?
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; } ``` -- Mike Wey
Jun 25 2016
parent reply TheDGuy <a.b gmail.de> writes:
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?
Jun 25 2016
parent reply TheDGuy <a.b gmail.de> writes:
On Saturday, 25 June 2016 at 21:57:35 UTC, TheDGuy wrote:
 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?
Okay, i tried it with a new private int-variable which contains the current index of the for-loop, like this: private void letButtonsFlash(){ foreach(Button btn;bArr){ btn.setSensitive(false); } for(int i = 0; i < level; i++){ index = i; //index is public 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(){ Button currentButton = bArr[rndButtonBlink[index]]; ListG list = currentButton.getStyleContext().listClasses(); string CSSClassName = to!string(cast(char*)list.next().data); currentButton.getStyleContext().removeClass(CSSClassName ~ "-flash"); return false; } But now the strange thing happens, that the first button lights up as expected but the second button remains at its "flash color" and doesn't go back to normal color, i don't understand why this happens? Any ideas?
Jun 25 2016
parent reply Mike Wey <mike-wey example.com> writes:
On 06/26/2016 12:10 AM, TheDGuy wrote:
 On Saturday, 25 June 2016 at 21:57:35 UTC, TheDGuy wrote:
 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?
Okay, i tried it with a new private int-variable which contains the current index of the for-loop, like this: private void letButtonsFlash(){ foreach(Button btn;bArr){ btn.setSensitive(false); } for(int i = 0; i < level; i++){ index = i; //index is public 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(){ Button currentButton = bArr[rndButtonBlink[index]]; ListG list = currentButton.getStyleContext().listClasses(); string CSSClassName = to!string(cast(char*)list.next().data); currentButton.getStyleContext().removeClass(CSSClassName ~ "-flash"); return false; } But now the strange thing happens, that the first button lights up as expected but the second button remains at its "flash color" and doesn't go back to normal color, i don't understand why this happens? Any ideas?
You should probably increment the index in the timeout_delay function. -- Mike Wey
Jun 26 2016
parent reply TheDGuy <a.b gmail.de> writes:
On Sunday, 26 June 2016 at 12:30:22 UTC, Mike Wey wrote:
 You should probably increment the index in the timeout_delay 
 function.
This leads to a Range violation exception...
Jun 26 2016
parent reply Mike Wey <mike-wey example.com> writes:
On 06/26/2016 05:03 PM, TheDGuy wrote:
 On Sunday, 26 June 2016 at 12:30:22 UTC, Mike Wey wrote:
 You should probably increment the index in the timeout_delay function.
This leads to a Range violation exception...
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. -- Mike Wey
Jun 26 2016
parent reply TheDGuy <a.b gmail.de> writes:
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').
Jun 26 2016
parent reply TheDGuy <a.b gmail.de> writes:
On Sunday, 26 June 2016 at 21:06:58 UTC, TheDGuy wrote:
 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').
I tried to debug a little and what i don't understand is, that i get two times 'blue' on the console, even though yellow and blue lit up but yellow stayed at the flash color: private void letButtonsFlash(){ foreach(Button btn;bArr){ btn.setSensitive(false); } for(int i = 0; i < level; i++){ index = i; Button currentButton = bArr[rndButtonBlink[i]]; //Array holds randomized Buttons ListG list = currentButton.getStyleContext().listClasses(); string CSSClassName = to!string(cast(char*)list.next().data); currentButton.getStyleContext().addClass(CSSClassName ~ "-flash"); Timeout t = new Timeout(() => this.timeout_delay(currentButton),1,false); } foreach(Button btn;bArr){ btn.setSensitive(true); } } bool timeout_delay(Button currentButton){ ListG list = currentButton.getStyleContext().listClasses(); string CSSClassName = to!string(cast(char*)list.next().data); writeln(CSSClassName); //try to debug currentButton.getStyleContext().removeClass(CSSClassName ~ "-flash"); return false; } The reason for the problem that buttons are flashing simultaneously might be, that the Timeout is running in an extra thread and therefore another Timeout is created by the mainthread in the for-loop even though the last one hasn't finished yet. But what i don't understand is why the last button doesn't go back to the normal CSSClass and that the first button has two timeouts (according to my console debug text)? It would be very much appreciated if someone who has GTKD installed can try my code: http://pastebin.com/h0Nx1mL6
Jun 29 2016
parent reply TheDGuy <a.b gmail.de> writes:
On Wednesday, 29 June 2016 at 10:41:21 UTC, TheDGuy wrote:
 I tried to debug a little and what i don't understand is, that 
 i get two times 'blue' on the console, even though yellow and 
 blue lit up but yellow stayed at the flash color:

     private void letButtonsFlash(){
         foreach(Button btn;bArr){
             btn.setSensitive(false);
         }
         for(int i = 0; i < level; i++){
             index = i;
             Button currentButton = bArr[rndButtonBlink[i]]; 
 //Array holds randomized Buttons
             ListG list = 
 currentButton.getStyleContext().listClasses();
             string CSSClassName = 
 to!string(cast(char*)list.next().data);
             
 currentButton.getStyleContext().addClass(CSSClassName ~ 
 "-flash");
             Timeout t = new Timeout(() => 
 this.timeout_delay(currentButton),1,false);
         }

         foreach(Button btn;bArr){
             btn.setSensitive(true);
         }
     }
     bool timeout_delay(Button currentButton){
         ListG list = 
 currentButton.getStyleContext().listClasses();
         string CSSClassName = 
 to!string(cast(char*)list.next().data);
         writeln(CSSClassName); //try to debug
         
 currentButton.getStyleContext().removeClass(CSSClassName ~ 
 "-flash");
         return false;
     }

 The reason for the problem that buttons are flashing 
 simultaneously might be, that the Timeout is running in an 
 extra thread and therefore another Timeout is created by the 
 mainthread in the for-loop even though the last one hasn't 
 finished yet.

 But what i don't understand is why the last button doesn't go 
 back to the normal CSSClass and that the first button has two 
 timeouts (according to my console debug text)?

 It would be very much appreciated if someone who has GTKD 
 installed can try my code:

 http://pastebin.com/h0Nx1mL6
Okay, i am quite sure now that this is some kind of bug: https://picload.org/image/rrrgwpgi/gtkd_timeout.png private void letButtonsFlash(){ foreach(Button btn;bArr){ btn.setSensitive(false); } for(int i = 0; i < level; i++){ index = i; Button currentButton = bArr[rndButtonBlink[i]]; //Array holds randomized Buttons ListG list = currentButton.getStyleContext().listClasses(); string CSSClassName = to!string(cast(char*)list.next().data); currentButton.getStyleContext().addClass(CSSClassName ~ "-flash"); writeln("Creating Timeout for : " ~ CSSClassName); Timeout t = new Timeout(() => this.timeout_delay(currentButton),1,false); } foreach(Button btn;bArr){ btn.setSensitive(true); } } bool timeout_delay(Button currentButton){ ListG list = currentButton.getStyleContext().listClasses(); string CSSClassName = to!string(cast(char*)list.next().data); currentButton.getStyleContext().removeClass(CSSClassName ~ "-flash"); writeln("Removing flash CSS color for: " ~ CSSClassName); return false; }
Jun 29 2016
parent reply Mike Wey <mike-wey example.com> writes:
On 06/30/2016 08:53 AM, TheDGuy wrote:
 On Wednesday, 29 June 2016 at 10:41:21 UTC, TheDGuy wrote:
 I tried to debug a little and what i don't understand is, that i get
 two times 'blue' on the console, even though yellow and blue lit up
 but yellow stayed at the flash color:

     private void letButtonsFlash(){
         foreach(Button btn;bArr){
             btn.setSensitive(false);
         }
         for(int i = 0; i < level; i++){
             index = i;
             Button currentButton = bArr[rndButtonBlink[i]]; //Array
 holds randomized Buttons
             ListG list = currentButton.getStyleContext().listClasses();
             string CSSClassName = to!string(cast(char*)list.next().data);
             currentButton.getStyleContext().addClass(CSSClassName ~
 "-flash");
             Timeout t = new Timeout(() =>
 this.timeout_delay(currentButton),1,false);
         }

         foreach(Button btn;bArr){
             btn.setSensitive(true);
         }
     }
     bool timeout_delay(Button currentButton){
         ListG list = currentButton.getStyleContext().listClasses();
         string CSSClassName = to!string(cast(char*)list.next().data);
         writeln(CSSClassName); //try to debug
         currentButton.getStyleContext().removeClass(CSSClassName ~
 "-flash");
         return false;
     }

 The reason for the problem that buttons are flashing simultaneously
 might be, that the Timeout is running in an extra thread and therefore
 another Timeout is created by the mainthread in the for-loop even
 though the last one hasn't finished yet.

 But what i don't understand is why the last button doesn't go back to
 the normal CSSClass and that the first button has two timeouts
 (according to my console debug text)?

 It would be very much appreciated if someone who has GTKD installed
 can try my code:

 http://pastebin.com/h0Nx1mL6
Okay, i am quite sure now that this is some kind of bug: https://picload.org/image/rrrgwpgi/gtkd_timeout.png private void letButtonsFlash(){ foreach(Button btn;bArr){ btn.setSensitive(false); } for(int i = 0; i < level; i++){ index = i; Button currentButton = bArr[rndButtonBlink[i]]; //Array holds randomized Buttons ListG list = currentButton.getStyleContext().listClasses(); string CSSClassName = to!string(cast(char*)list.next().data); currentButton.getStyleContext().addClass(CSSClassName ~ "-flash"); writeln("Creating Timeout for : " ~ CSSClassName); Timeout t = new Timeout(() => this.timeout_delay(currentButton),1,false); } foreach(Button btn;bArr){ btn.setSensitive(true); } } bool timeout_delay(Button currentButton){ ListG list = currentButton.getStyleContext().listClasses(); string CSSClassName = to!string(cast(char*)list.next().data); currentButton.getStyleContext().removeClass(CSSClassName ~ "-flash"); writeln("Removing flash CSS color for: " ~ CSSClassName); return false; }
Is the complete source available some ware? -- Mike Wey
Jun 30 2016
parent TheDGuy <a.b gmail.de> writes:
On Thursday, 30 June 2016 at 20:11:17 UTC, Mike Wey wrote:
 Is the complete source available some ware?
Yes, here: http://pastebin.com/h0Nx1mL6
Jun 30 2016