Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Recommendations for the most useful Delphi TStringGrid (Grid) replacement

One of the weaker areas of Delphi are the grids (eg TStringGrid) where, although it does a good basic job, it becomes harder when you need to print it or customise its appearance. I've used it for about 15 years thus its pretty embedded within my apps and over time I've home-rolled solutions for TGrid-to-RTF conversion (for printing via MSWord) and used TDrawGrid for a bit more customisation. My solutions (still) have to work in both Delphi 7 and Delphi XE. As it happens, none of my grids are DB-bound, they are all cell-populated in code.

Now I'm planning to sort out my reporting and 'pretty-up' my forms which means replacing the grid with a more capable implementation. There are loads out there and I've got two of them Developer Express Quantum Grid and the TMS Grid Pack. Time is very limited though to experiement with fonts, colours and printing and I would appreciate recommendations for which of the many grid / print-display report combinations I should adopt. I presenty do not have a report generator and was considering FastReports but I'm open to suggestions.

like image 901
Brian Frost Avatar asked Jun 28 '11 06:06

Brian Frost


3 Answers

In about 1998 I got tired of TStringGrid and began a long journey outwards. I have used virtual grid view controls heavily, including Roman Mochalev's ExGridView (ported to Delphi 2010/XE here) and developer express's quantum grid control, and the printing suite that goes with it, as well as Virtual Tree View by Mike Lischke. Yes. It's a tree view. But if you don't create multiple levels of nodes, it makes a pretty great virtual grid too.

In the end, none of these are perfect. Your application's requirements may include:

  • Printing. If so, I would go towards the Developer Express components since their grid component, and other components, have printing support built into in their printing suite.

  • A lot of custom painting, but no printing. If so, I would go back to the VCL TDrawGrid, because otherwise more complex stock painting systems are just going to get in your way.

  • Keeping it simple. If so, I recommend the ExGridView component. The other solutions all seem to get me 98% of the way there, and require a tonne of maintenance to solve custom painting glitches, printing glitches, or whatever else. If all you want is a Windows 2000 era looking virtual grid showing data from your model, use ExGridView.

  • Could need to nest nodes (tree stuff) in the future. Then just start with VirtualTreeView now, and use it as a grid for now, and seamlessly add tree functionality later.

There are many more "additional requirements" that are possible in your case, than I can possibly think of and list here. But it's these "also" things that will (or should) dictate your choice. Your application has to run 24/7/365.25? Well, then keep it simple, and avoid fancy stuff that will hurt you later.

Since you state you need printing, nice looking themed painting, and you already own the Developer Express components, that would be the #1 most logical choice. It is a stable, mature, and high-quality component suite. For other people who view this question later, my only caveat is that it's a complex, heavy-weight solution, and not right for 100% of all Delphi apps that "just need a workable grid better than TStringGrid". DevEx Quantum Grid can copy just about every grid feature you have ever seen in Outlook, for example, including "group by" functionality.

like image 111
Warren P Avatar answered Nov 14 '22 16:11

Warren P


The Virtual Treeview component might be a possibility. We use it as a grid in our application. I haven't tried printing, but I will at some point in the near future. It can export to rich text or html, which could be useful for that.

EDIT: It's open source and quite polished, by the way.

EDIT2: Corrected the name of the component. I had done this originally, but it got lost when I made the link.

like image 25
boileau Avatar answered Nov 14 '22 15:11

boileau


I can strongly recommend to go with ExpressQuantumGrid!

You could think about a TStringGridToCxGrid facade class which replaces the TStringGrid and translates your legacy code to TcxGrid.

like image 21
splash Avatar answered Nov 14 '22 15:11

splash