Home > Net >  Inherited frames - missing properties
Inherited frames - missing properties

Time:02-14

I have a project which consists of numerous different frames. Some of those frames are inherited from each other. Here's the basic setup:

  • TBaseFrame
    • TFrame1
      • TFrame1A
      • TFrame1B
    • TFrame2
      • TFrame2A

...and so on.

Everything was working fine and dandy. I've been able to compile and run my project with this setup all day long. However, at some point, it started completely failing and crashing.

On application startup, shortly after the main screen shows, I receive this error:

Error message1

Oddly, nothing in my application is even creating or using any of those frames yet - the frames are on a form which is explicitly created only after login (and I confirmed it's not on auto-create).

Once I press OK, my application terminates, and then shows this error:

Error message 2

After some digging, I discovered something very odd in the IDE. I closed Delphi and re-opened it, and I'm still seeing this discrepancy.

On the base frame (TBaseFrame), it does not show any ClientWidth or ClientHeight properties:

Base frame properties

However the inherited frame (TFrame1) does:

Inherited frame properties

It seems as if the inherited frame is being treated as if it's a form, especially seeing a Caption property there which shouldn't belong.

Why did this happen and how do I fix it?

EDIT

To add, when I go to my project options, it's offering me to add many of the frames to auto-create, which should not be possible. And in fact one of the frames (the most recently created one) is already set to auto-create. But it's a frame, not a form.

EDIT 2

After finding and removing the 1 frame from the project's auto-create, as well as removing another (unrelated) frame which had class name conflicts and re-adding it to the project, now I'm able to at least compile the project and run it. Yet still numerous frames appear as if they're forms.

CodePudding user response:

You are experiencing a problem with the IDE designer of some Delphi versions where it forgets about an inherited frame being a frame.

To fix this, open the project source and add a ": TFrame" after the component name of the affected frame. Save, close and reopen the project.

This is an example how it should look like:

 MyFrame1 in 'MyFrame1.pas' {Frame1: TFrame};
  • Related