I'm trying to define a child class of TCustomFrame but I get an error on TabOrder property.
These are steps I've followed:
Switch the parent class from TFrame to TCustomFrame.
TMyFrame = class(TCustomFrame)
Check TFrame definition and publish exactly the same properties (Doing so, TMyFrame should be identical to TFrame, right?).
It gets an error which says that TabOrder property does not exist.
Could someone clarify what's wrong in what I did and how to properly create a TCustomFrame's child class?
What matters is that the published property exists in the design-time package that the component resides in for the IDE to be able to stream it.
When you add a frame to your project, the corresponding 'dfm' file includes properties published in the TFrame
class. That includes TabOrder
and others. When you close and re-open the project it cannot find TabOrder
in TCustomFrame
, hence the error.
To be able to explain with a more common component, add a form to your project. Add a published property to your form. Save the project, close and re-open. You won't see your published property in the object inspector. If the IDE would try to stream your property, it would give an error.
For proper operation, what you need to do is to register your component in the tool palette. You need to compile it in a package for that because you won't be able to use "add to palette" shortcut on a TCustomFrame
. See documentation for details about how to achieve that. You can start with a unit containing a TFrame
descendant for convenience, but don't forget to manually delete (Alt+F12) the properties you un-publish after you've changed the ascendant before saving your unit.