IDE将TFrame视为Form

IDE将TFrame视为Form

本文介绍了Delphi IDE将TFrame视为Form的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每当我调整我的TFrame类(添加属性,方法等)时,IDE会感到困惑,并且表现得好像它认为框架是一个表单,包括标题/标题,边框等。然而,显然这个类被宣布为TFrame后代。有关导致此问题的原因,如何预防以及如何解决的任何想法?

Every once in a while when I am tweaking my TFrame classes (adding properties, methods, etc), the IDE gets confused and acts as if it thinks the frame is a form, complete with header/caption, borders, etc. Yet, clearly the class is declared as a TFrame descendent. Any ideas as to what causes this, how to prevent, and how to fix?

我正在使用Delphi 2007专业版。另请注意(如果重要),TFrame后代通常通过设计时包在IDE(即调色板)上注册。

I'm using Delphi 2007 Pro. Also note (if it matters), the TFrame descendents are typically registered with the IDE (i.e. on the palette) via a design-time package.

后来:其他细节:目前我遇到这个问题的框架在视觉上是一个非常基本的TFrame(仅从全新的TFrame改变大小和背景颜色)。

Later: Additional "specifics": The frame that I'm having this problem with at the moment is, visually, a VERY basic TFrame (only change from brand new TFrame is size, and background color).

这是它的类声明:

TBasePanel = class(TFrame)
  private
    FPanelManager: TPanelManager;
    procedure SetPanelManager(const Value: TPanelManager);
  protected
    procedure Connect; virtual; abstract;
    procedure Disconnect; virtual; abstract;
    procedure Refresh; virtual;
    procedure Requery; virtual; abstract;
  published
    property PanelManager: TPanelManager read FPanelManager write
        SetPanelManager;

此框架用作许多其他框架的基类。我通常直接从它所属的BPL项目编辑它(因为所有这些框架安装到调色板中),而不是作为EXE项目的一部分,相关的表格打开等。

This frame is used as a base class for a number of others. I am usually editing it directly from the BPL project it belongs to (because all of these frames install to the palette), rather than as part of an EXE project, with related Forms open etc.

此外,在工具 - >选项中选中嵌入式设计器。

Also, "Embedded designer" is checked in Tools -> Options.

我将所有DFM文件保存为文本而不是二进制文件(如果这一点很重要)。

I am saving all DFM files as text rather than binary as well (if that matters at all).

推荐答案

我遇到了同样的问题。以下步骤解决了我们的问题,它可能也适用于您:

I have encountered the same problem. The following steps solved the problem for us, it might also work for you:


  1. 在IDE中:关闭所有使用框架的表单

  2. 打开框架,查看为文本(* .dfm)

  3. dfm可能以对象MyFrame开头:TMyFrameClass

  4. 将此更改为继承的MyFrame:TMyFrameClass

  1. in the IDE: close all forms that use the frame
  2. open the frame, view as text (*.dfm)
  3. the dfm probably begins with object MyFrame: TMyFrameClass
  4. change this to inherited MyFrame: TMyFrameClass

我不知道导致问题的原因。

I don't know what caused the problem.

这篇关于Delphi IDE将TFrame视为Form的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-25 06:41