Re: GTKD - CSS class color "flash" delay

2016-06-30 Thread TheDGuy via Digitalmars-d-learn
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

Re: GTKD - CSS class color "flash" delay

2016-06-30 Thread Mike Wey via Digitalmars-d-learn
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

Re: GTKD - CSS class color "flash" delay

2016-06-30 Thread TheDGuy via Digitalmars-d-learn
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

Re: GTKD - CSS class color "flash" delay

2016-06-29 Thread TheDGuy via Digitalmars-d-learn
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

Re: GTKD - CSS class color "flash" delay

2016-06-26 Thread TheDGuy via Digitalmars-d-learn
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 =

Re: GTKD - CSS class color "flash" delay

2016-06-26 Thread Mike Wey via Digitalmars-d-learn
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){

Re: GTKD - CSS class color "flash" delay

2016-06-26 Thread TheDGuy via Digitalmars-d-learn
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...

Re: GTKD - CSS class color "flash" delay

2016-06-26 Thread Mike Wey via Digitalmars-d-learn
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

Re: GTKD - CSS class color "flash" delay

2016-06-25 Thread TheDGuy via Digitalmars-d-learn
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

Re: GTKD - CSS class color "flash" delay

2016-06-25 Thread TheDGuy via Digitalmars-d-learn
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:

Re: GTKD - CSS class color "flash" delay

2016-06-25 Thread Mike Wey via Digitalmars-d-learn
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

Re: GTKD - CSS class color "flash" delay

2016-06-25 Thread TheDGuy via Digitalmars-d-learn
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'

Re: GTKD - CSS class color "flash" delay

2016-06-25 Thread TheDGuy via Digitalmars-d-learn
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

Re: GTKD - CSS class color "flash" delay

2016-06-25 Thread TheDGuy via Digitalmars-d-learn
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

Re: GTKD - CSS class color "flash" delay

2016-06-25 Thread Mike Wey via Digitalmars-d-learn
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:

Re: GTKD - CSS class color "flash" delay

2016-06-24 Thread TheDGuy via Digitalmars-d-learn
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(){

Re: GTKD - CSS class color "flash" delay

2016-06-24 Thread Gerald via Digitalmars-d-learn
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

GTKD - CSS class color "flash" delay

2016-06-24 Thread TheDGuy via Digitalmars-d-learn
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 =