我有一個專案,它由許多不同的框架組成。其中一些框架是相互繼承的。這是基本設定:
- TBaseFrame
- TFrame1
- TFrame1A
- TFrame1B
- TFrame2
- TFrame2A
- TFrame1
...等等。
一切都很好,花花公子。我已經能夠整天用這個設定編譯和運行我的專案。但是,在某些時候,它開始完全失敗并崩潰。
在應用程式啟動時,在主螢屏顯示后不久,我收到此錯誤:

奇怪的是,我的應用程式中還沒有創建或使用任何這些框架——這些框架位于一個僅在登錄后才顯式創建的表單上(我確認它不是自動創建的)。
按 OK 后,我的應用程式將終止,然后顯示此錯誤:

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:

However the inherited frame (TFrame1) does:

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.
uj5u.com熱心網友回復:
您在使用某些 Delphi 版本的 IDE 設計器時遇到問題,它忘記了繼承的框架是框架。
要解決此問題,請打開專案源并在受影響框架的組件名稱后添加“:TFrame”。保存、關閉并重新打開專案。
這是一個示例:
MyFrame1 in 'MyFrame1.pas' {Frame1: TFrame};
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/424209.html
標籤:delphi inheritance vcl delphi-10.4-sydney tframe
上一篇:如何要求子類方法呼叫父類方法?
下一篇:如何強制執行嵌套類屬性?
