Question

Does anyone know if Delphi XE (I'm talking VCL here) has any Generic Collection classes that work with data-aware controls? In other words, are there any Generic classes, like TObjectList<> that can be assigned to TDataSource.DataSet, or something similar?

Thanks.

Dan

Was it helpful?

Solution

Yes you can, using an ObjectDataSet concept, which I think you would end up having to implement yourself based on the linked sample code as a starting place.

The sample code shows how to fuse the concept of a regular non-generic TObjectList and a TDataSet. It uses RTTI to provide any list you wish to attach to it, of any object type. It uses RTTI and does not need to use Generics, rather it requires that you inherit from TPersistent.

The bad side of it, is that I have used it, and I would never use it again. The resulting code was a mess, was slow, and the model was horrible. Next time, I would stay away from data aware controls, and simply use containers with VIRTUAL CONTROLs like VirtualTreeView, and ExGridView.

I see no reason why you couldn't start with the above code as a base, and combine generics with data binding, but I can see lots of reasons why you shouldn't.

OTHER TIPS

To have another opinion:

They both can use Generic Collection classes as expected with binding capablity which makes exposing data to visual components quite easy.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top