Delphi generic control possible?

314 Views Asked by At

So I have a delphi combobox that looks like this (Rad Studio 2007 .net)...

TEnumComboBox<T> = class(TComboBox)

the idea is that it can take any enum type and populate itself from there. Struggling to actually get the form that it's used in to compile. I have something in the nfm...

object DataTypeBox: TEnumComboBox<DataType>
...
end

and something in the pas file, in the published bit...

DataTypeBox : TEnumComboBox<DataType>;

I get the following error:

Error: E2217 Published field 'DataTypeBox' not a class or interface type

If I move the declaration of DataTypeBox out of the published bit and into the private bit I get a DCC error code 1.

So, am I wasting my time trying to get a generic control to work in delphi 2007 (Delphi for Microsoft .NET)? Thanks.

1

There are 1 best solutions below

4
On

Delphi 2007 did not support generics. They were introduced in Delphi 2009.