Recent

Author Topic: TStringGrid OnDrawCell  (Read 1111 times)

jcmontherock

  • Full Member
  • ***
  • Posts: 235
TStringGrid OnDrawCell
« on: June 10, 2021, 11:04:41 am »
Hello,

I have a problem with TStringGrid OnDrawCells. In my app when I try to show the last row of the grid, not at first time visible, last cell of last row of grid was not been processed by Drawcell
So, I wrote a little program to show you the fact and I found 2 strange problems:

1) The program enters in loop as soon as started, if at end of OnDrawCells procedure, I add “Application.ProcessMessages”. It don’t show any data. Without that grid shows data, but is in loop.
2) When I try to see the last row of StrinGrid the first line shows “mixed” text between fixed row and data.

In my first app I do not have loop or I didn’t see it. I believe that it happens in the test pgm because it’s too short. But, why ondrawcell event is fired when all visible cells did not change ?
The real problem is when we are scrolling down to see the last line.
Which error I did ?

Windows 10/64, Laz 2.0.12, FPC 3.20, svn 64642
Windows 11 UTF8-64 - Lazarus 3.2-64 - FPC 3.2.2

jcmontherock

  • Full Member
  • ***
  • Posts: 235
Re: TStringGrid OnDrawCell
« Reply #1 on: June 10, 2021, 11:51:04 am »
I found why there is a loop: we don't need to add "StringGrid1.BeginUpdate" and "StringGrid1.EndUpdate" in DrawCell procedure.
Windows 11 UTF8-64 - Lazarus 3.2-64 - FPC 3.2.2

 

TinyPortal © 2005-2018