tags:

views:

168

answers:

1

I have a TGraphicControl descendant which paints rather slowly. There's also a TWinControl descendant, this one paint fast. Both controls are on the same TPanel.

While scrolling, the TGraphicControl is updated more often than the TWinControl, so they look out of sync. This updating is done by Windows and/or the VCL, not by my code.

I can solve this by calling TWinControl.Update from the TGraphicControl.Paint method, but I'm a bit worried this might cause problems one way or another.

Is it safe to do this?

+1  A: 

As long as there isn't a call back to your twincontrol that should be fine. You might get the twincontrol updating more often than strictly necc but thats all.

Toby Allen
Makes sense. I've tweaked the parent panel so its WMPaint handler updates any child TWinControls. Any recursive loops are avoided this way.
Giel