Thursday, 25 May 2017

Frame Inheritance - TabOrder: Property does not exist - Issue Fixed

I've been working on an application recently and it has a few frames (TFrame), I noticed that there were common properties and methods to all the frames, so I decided that they should derive from a base class. I created the base frame class and then in code derived the other frames from the base frame. It all seemed to work fine a build and ran OK, however after closing the project and then coming back to it a few days later, when I tried to open a frame I received an error stating the TabOrder property does not exist, I ignored it and received more property does not exist errors (I did not save any changes). The solution to this problem was simple, in the .dfm file at the top was:

object TestFrame: TTestFrame 

This needed to be changed to:

inherited TestFrame: TTestFrame

The ideal way to do this is at design time when designing the structure of the application, if there is an abstract or concrete frame class then this should be added to the repository so when a developer needs to create a new frame, they can simply inherit the frame from the one in the repository.

This is a very similar problem to inheriting datamodules, I've also had to do something similar.