I have a custom control:
type TContosoFrobber = class(TCustomControl) private end;
Inside my component creates a control :
type TContosoFrobber = class(TCustomControl) private FMyDateTimePicker: TDateTimePicker; public constructor Create(AOwner : TComponent); override; property DateTimePicker: TDateTimePicker read FMyDateTimePicker; end; constructor TContosoFrobber.Create(AOwner: TComponent); begin inherted Create(AOwner); FMyControl := TMyDateTimePicker.Create(AOwner); end;
where TMyDateTimePicker is a simple descendant of TDateTimePicker
TMyDateTimePicker = class(TDateTimePicker) protected end;
So, summarize what I did:
- declare a private variable
TDateTimePicker - output it as a public property (i.e. not published ) of type
TDateTimePicker - through polymorphism, control is actually a descendant of
TDateTimePicker
And it all worked - until I recently stopped installing Delphi XE6 (on Windows 10).
Dfm
This is why I couldn’t understand why I got an error during development:
TMyDateTimePicker Class Not Found
Why is he trying to find this class? This class is in implementation details; It is not published for streaming. How does a streaming system even try to create one !? So I check DFM:
object cfBeachBall: TContosoFrobber Left = 445 Top = 25 Width = 101 Height = 22 ...snip... object TMyDateTimePicker Left = 0 Top = 0 Width = 101 Height = 22 Date = 37306.581535243100000000 Time = 37306.581535243100000000 TabOrder = 0 TabStop = False end end
Why TInternalDateTimePicker end in dfm:
- property is publicly available and not published
How to stop the form streaming system from placing an unpublished property in dfm?
Worst of all is an IDE bug
Not only this sometimes includes a property that he should not. Sometimes it includes a property that it should not double:
object cfPlasticBag: TContosoFrobber Left = 445 Top = 25 Width = 101 Height = 22 ...snip... object TMyDateTimePicker Left = 0 Top = 0 Width = 101 Height = 22 Date = 37306.581535243100000000 Time = 37306.581535243100000000 TabOrder = 0 TabStop = False end object TMyDateTimePicker Left = 0 Top = 0 Width = 101 Height = 22 Date = 37306.581535243100000000 Time = 37306.581535243100000000 TabOrder = 0 TabStop = False end end
- How to stop dfm from storing unpublished properties?
- How to stop dfm from turning it on twice?
Hack workaround
I know a terrible hack: tell DFM about management that no business should know about:
initialization RegisterClass(TMyDateTimePicker); finalization UnRegisterClass(TMyDateTimePicker); end.
Now dfm contains a control that it does not know about. Each time I save a form, it will contain links to things that it should not. And worst of all: I confirmed the erroneous belief in TMyDateTimePicker .
Why didn't Delphi XE6 do this before reinstalling? Perhaps I need to install the latest update of the latest version of Delphi without support?
Known bug?
