[Gambas-user] Again on DrawingArea

PV oreip at ...1...
Mon Aug 1 11:31:49 CEST 2005


On 01/08/2005 02:28, Rob wrote:

> I have no idea what happened, but when using any language and any 
> graphical toolkit that fires a redraw event, I always make a global 
> (or module-level) variable called something like CurrentlyRedrawing, 
> check to see if it's nonzero at the beginning of the draw event code, 
> exit if it is, set it if it's not, and unset it at the end of the 
> draw event.

Rob, thanks for your suggestion.

However in this case it is of no use because it seems that the Draw event is 
triggered sequentially, so that, when it is called, CurrentlyRedrawing is set, 
the drawing routines are performed, CurrentlyRedrawing is cleared and then the 
Draw event is fired again, and since CurrentlyRedrawing has been cleared, the 
Draw event is repeated in an endless loop anyway.

Playing a bit more with the code instead, I finally spotted the glitch, or at 
least a part of it.
It appears that setting DrawingArea1.Background and/or DrawingArea1.Backcolor 
inside the Draw event is what is causing the code to loop and consequently the 
100% CPU usage.

Please note however that in versions < 1.9.13 these same lines of code weren't 
doing any harm and the redrawing speed was visibly greater.
I will investigate more... :-)


Ciao,
Piero




More information about the User mailing list