-2

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.

Jerry Dodge
  • 26,858
  • 31
  • 155
  • 327
  • I also somehow didn't realize that the form designer is also showing as if it's a form until now, but it's definitely inheriting from a frame, and that ancestor frame is just fine. – Jerry Dodge Feb 12 '22 at 23:18
  • Answer to be found in the source code which we can't see. Make a [mcve]. – David Heffernan Feb 13 '22 at 11:37
  • @David It's source code which I cannot see or recreate either. If I knew where the problem was, I wouldn't need to ask for help... And actually, the solution was to manually modify a particular DFM, something which I would have never known where to look without the help of the accepted answer below (and its comments). – Jerry Dodge Feb 13 '22 at 13:43
  • You could have cut the real program down. You can see the source code. If you can't see your own source code you cannot compile it. You know how this site works. You need to provide specifics. Otherwise where is the value for the future reader? – David Heffernan Feb 13 '22 at 13:59
  • @David The issue was in 3 entirely different files, none of which were written by me, but managed by the IDE. It's an IDE bug. And I most certainly am not going to post the source of my DPROJ file. The project has over 100 files in it. And value for future readers? Well, if someone else has the same problem, they're going to want the solution to the problem, not a bunch of code which reproduces it... Anyway, this is why I rarely come to SO anymore, because I ALWAYS get responses like this. – Jerry Dodge Feb 13 '22 at 14:06
  • If you want help with your specific problems, and don't want to provide the details, then you are quite right to go elsewhere because that isn't what SO is for. Nobody is asking for your actual source code, just a reproduction cut down from the actual project. – David Heffernan Feb 13 '22 at 16:25
  • Also I don't think it's an IDE bug if you were using visual form inheritance (VFI) but the dfms didn't start with inherited – David Heffernan Feb 13 '22 at 17:29
  • @DavidHeffernan Every instance of inherited forms in this project was from going to Project > Add New > Inheritable Items > Frame. None of the issues discovered were in any code which I touched - I never have a reason to open DFM or DPROJ files, and in this case I never even had a reason to open the DPR either. And to strip this project down to a reproducable example would take at minimum 2-3 days - time I do not have available. – Jerry Dodge Feb 13 '22 at 17:35
  • If you don't have the time that's your problem, not ours. Doesn't trump the rule and guidance for this site. If you want personal help like this, asked in this form, use Delphi Praxis which is perfect for your needs. – David Heffernan Feb 13 '22 at 17:36
  • Only thing I did between the time of the project last working and first exhibiting issues was add 1 new inherited frame, the 5th of its kind. And it was that last one which apparently broke things, as that's the one which ended up marked as auto-create in the project settings, and its ancestor frame started getting treated like a form. – Jerry Dodge Feb 13 '22 at 17:37

1 Answers1

2

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};
Uwe Raabe
  • 45,288
  • 3
  • 82
  • 130
  • Although I did find 2 frames not marked as so, the one(s) in question were not either of those, and the IDE still shows as if they're a form after fixing and re-opening Delphi. Project settings also still offers me to auto-create numerous frames as if they were forms. Could it be the DPROJ file? – Jerry Dodge Feb 12 '22 at 23:00
  • Can you check if there is a DesignClass subnode of the DCCReference node of the affected frames with text TFrame? – Uwe Raabe Feb 12 '22 at 23:04
  • It shows: `TFrame` – Jerry Dodge Feb 12 '22 at 23:07
  • I'm starting to wonder if it's due to the order of how they're listed in the main project file, because the inherited one is listed before its ancestor... - **EDIT** Nope, that didn't do the trick either. – Jerry Dodge Feb 12 '22 at 23:09
  • Have you inspected the DFM? Does it still start with `inherited`? – Uwe Raabe Feb 12 '22 at 23:31
  • It appears not - just that one particular frame "`TFrame1`", which was both inherited from a base and further also an ancestor for another. Once I changed `object` to `inherited`, and opening those units in the project, it prompted me finally to remove those properties which don't belong, and they no longer show. Frames are still showing in the project settings as if they're forms (available for auto-create) which I'm pretty sure shouldn't be possible, but at least the core issue has been resolved. – Jerry Dodge Feb 13 '22 at 13:40