[Lazarus] Optimize DBGrid speed

Petr Kristan petr.kristan at epos.cz
Wed Jan 8 09:39:29 CET 2014

On Mon, Jan 06, 2014 at 03:21:56PM +0200, Juha Manninen wrote:
> On Mon, Jan 6, 2014 at 2:29 PM, Petr Kristan <petr.kristan at epos.cz> wrote:
> > I'am trying to minimize whole DBGrid redraw. Where I can discuss my
> > steps to avoid my pointless work.
> >
> > Most of code what I plan to change was commited by jesus.
> The choices are this list or private mails with Jesus (jesusrmx at gmail.com).
> It depends on how interesting the discussion is for other people.
> (See the related thread about private communication :)
> You should send a private mail in any case because he may not notice this.
I tried it, but no response till now.

Then I try try send another question about grid speed opt. here.

In the beginning of Grid paint is Canvas.GetClipRect called to obtain area
which wee must redraw. This function directly calls WidgetSet.GetClipBox.
I find out difference betwen Win32 and gtk2 bahaviour of this func.

In gtk2 TGtk2WidgetSet.GetClipBox returns previously Invalidated area
(through DC.PaintRectangle = PS.rcPaint retrieved in BeginPaint)

But in win32 directly calls Windows.GetClipBox, but this func returns
whole grid area. Do not takes account on invalidated area retrieved in

Result of this difference is whole grid redraw in windows, even if only
one cell is invalidated.

Question si how to correct this?
Modify TWin32WidgetSet.GetClipBox to behave as TGtk2WidgetSet.GetClipBox?
I'am not sure, because GetClipBox should probably correspond to Win32
How is this solved in another widgetsets?


Petr Kristan
EPOS PRO s.r.o., Smilova 333, 530 02 Pardubice
tel: +420 461101401    Czech Republic (Eastern Europe)
fax: +420 461101481

More information about the Lazarus mailing list