getting a handle on the rows currently displayed in dbgrid lazarus / 16-Databases ---------------------------------------------------------------------- pir8don · 2012-12-05 08:09 I am attempting to provide a sum2date column in a grid using sql and have it working fine called by oncalc event - but as you can imagine it is resource hungry using a dataset of around 2k. Does anyone know of a way to tell for a given data row if it is currently displayed in the grid? They are ordered by date so I only need to know the cell values at the top and bottom of the grid to get the rest. I've done it before in Delphi using the ondrawcell event but it was messy and of course this is one area of difference with lazarus. I can also use the onscroll event but that doesn't cover other movement. I'd appreciate any help. Don (newbie) ---------------------------------------------------------------------- kjteng · 2014-01-17 23:35 I am not sure whether this is the correct way but this works for me:                        TStringGrid(dbgrid1).row ---------------------------------------------------------------------- kpeters58 · 2014-01-20 22:24 I am surprised to hear that you experience the calc event with a mere 2,000 records as slow - you are sure you haven't gotten visual control updating into the mix (think Dataset.DisableControls/EnableControls)? Aside from that, I do not understand how knowing which records are currently displayed would help you - wouldn't your calculation always have to include all records (independent of being displayed) to be even remotely useful? In Delphi you could have used Internal Calc fields to reduce overhead - something that does not (yet?) exist in Lazarus.