I'm doing a conversion of several Delphi 2005 apps to XE2 and they use a component that no longer is available, so I've written my own custom component to handle the basics, which is generally OK when you drop the component onto a form, however I ran into a problem when I open a VCL form containing this component that has properties already set in the DFM.
Delphi 2005 DFM contains something like this:
object ExtendedGrid1: TExtendedGrid
Left = 32
Top = 16
Width = 577
Height = 257
TabOrder = 0
Columns.Columns = (
'OE6.02'
(
'Test1'
64
False
0
'clWindowText'
-11
'Tahoma'
0
8
False
False
False
False
0
1
0
0
0
1
0
'clWindowText'
-11
'Tahoma'
0
8
False
False
False
False
0
1
0
'test2'
64
False
0
'clWindowText'
-11
'Trebuchet MS'
0
8
True
True
False
False
0
1
0
0
0
1
0
'clWindowText'
-11
'Tahoma'
0
8
False
False
False
False
0
1
0
''
'0'))
RowHeights = (
19
19)
end
Even though my component has a Columns property based on a class inheriting from TCollection, and I've added a Columns property to the collection which uses the inherited Items, I get this error when I try and open the form in the designer:
Error creating form: Error reading MyGrid1.Columns.Columns: Property Columns does not exist.
If I create a new copy of my component, then set the columns up, I see something completely different in the DFM:
Columns = <
item
Title = 'Test1'
Width = 64
Editable = False
HeaderClipStyle = csClip
HeaderFont.Charset = DEFAULT_CHARSET
HeaderFont.Color = clWindowText
HeaderFont.Height = -11
HeaderFont.Name = 'Tahoma'
HeaderFont.Style = []
HeaderHAlign = haRight
HeaderInnerBevel = bvNone
HeaderOuterBevel = bvNone
HeaderBorderWidth = 0
HeaderBevelWidth = 0
ContentsClipStyle = csClip
ContentsFont.Charset = DEFAULT_CHARSET
ContentsFont.Color = clWindowText
ContentsFont.Height = -11
ContentsFont.Name = 'Tahoma'
ContentsFont.Style = []
ComboFilled = False
ComboEditable = False
end
item
Title = 'test2'
Width = 64
Editable = False
HeaderClipStyle = csClip
HeaderFont.Charset = DEFAULT_CHARSET
HeaderFont.Color = clWindowText
HeaderFont.Height = -11
HeaderFont.Name = 'Trebuchet MS'
HeaderFont.Style = []
HeaderInnerBevel = bvNone
HeaderOuterBevel = bvNone
HeaderBorderWidth = 0
HeaderBevelWidth = 0
ContentsClipStyle = csClip
ContentsFont.Charset = DEFAULT_CHARSET
ContentsFont.Color = clWindowText
ContentsFont.Height = -11
ContentsFont.Name = 'Tahoma'
ContentsFont.Style = []
ComboFilled = False
ComboEditable = False
end
end>
Can anyone point me to some articles or explanations that will allow me to write my custom component so it can handle the old Delphi 2005 DFM's? Thanks.