GTKD - CSS class color "flash" delay

Gerald via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Jun 24 09:44:59 PDT 2016


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


More information about the Digitalmars-d-learn mailing list