[Lazarus] String Grid Component
Werner Pamler
werner.pamler at freenet.de
Mon Nov 27 16:21:36 CET 2017
Am 27.11.2017 um 13:43 schrieb Torsten Bonde Christiansen via Lazarus:
> I am looking for grid component that can display string. Simple
> enought and i know of a few already, but the ones i know of cannot do
> both of the following requirements i have:
>
> a) Fast (very low delay on 100.000+ lines of test)
> b) Allow selecting multiple cells spanning rows and colomns.
>
> For a) i know of VirtualTreeview which handles large data very very
> fine. The problem is that is does not allow for selecting multiple
> columns and rows combined.
>
> For b) there is the native LCL stringgrid, the lazarus package
> TKontrols is also good, but they don't handle large data very well.
> Mostly because all rows/columns are traversed (initialized) instead of
> the just the actual rows/columns displayed onscreen.
(a) What is "fast"? If I populate a standard TStringGrid with 100.000
rows x 100 columns (= 10 millions of cells) it takes about 9 seconds on
my PC - if BeginUpdate/EndUpdate is used. Not too bad in my eyes. If
it's too long you should use a TDrawGrid and paint the cells in the
OnDrawCell event. Since this draws only the visible cells it will occur
within the blink of an eye. Editing a TDrawGrid is a bit more
complicated, though, but doable.
(b) Multiselection has been added to the LCL grids (StringGrid and
DrawGrid) some time ago. Set option goRangeSelect, and - if the cells
selected are not contiguous - change RangeSelectMode to rsmMulti. Then
you can select individual cells by Ctrl- and Shift-Clicks like you know
from Excel.
Of course you should ask yourself the question: Is a grid with millions
of cells really something a user wants to work with?
More information about the Lazarus
mailing list