【问题标题】:Delphi 2009: How do I prevent frame children from spilling into host form?Delphi 2009:如何防止框架子级溢出到主机窗体中?
【发布时间】:2010-11-05 04:23:55
【问题描述】:

自从我升级到 Delphi 2009 以来,我对 TFrame 后代的体验很糟糕。基本上,框架的子组件作为对象溢出到主机表单中,导致名称崩溃、找不到类等。在 dfm 中,使用的旧 Delphi 的框架为 inline,子组件为 @987654322 @。 Delphi 2009 IDE 现在将子级扩展为object

编辑:我已经看到它发生在多种形式上,但我无法用小型演示应用程序重现它。

【问题讨论】:

  • 我没有遇到任何问题。能举个例子吗?
  • 这里相同 - 继承框架没有问题。我经常使用它们。
  • sigh 我遇到过这样的错误,我无法简化为简单的 POC。看看你是否能找到某种方法向 QC 报告。

标签: delphi delphi-2009 frame


【解决方案1】:

我不知道您的项目发生了什么,但我刚刚创建了一个全新的 D2009 应用程序:
- 一个主窗体,
- 一个包含 Edit1 和 Label1 的祖先框架,
- 一个从祖先下降的子框架,我在其中添加了一个 Label2 和一个 Edit2
- 放置在主窗体上的 ChildFrame 的一个实例,我在其中稍微移动了 Label2。

这是看起来很正常的 dfm

object MyForm: TMyForm
  Left = 0
  Top = 0
  Caption = 'MyForm'
  ClientHeight = 286
  ClientWidth = 412
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'Tahoma'
  Font.Style = []
  OldCreateOrder = False
  PixelsPerInch = 96
  TextHeight = 13
  inline ChildFrame1: TChildFrame
    Left = 8
    Top = 8
    Width = 313
    Height = 240
    TabOrder = 0
    ExplicitLeft = 8
    ExplicitTop = 8
    ExplicitWidth = 313
    inherited Label2: TLabel
      Left = 162
      ExplicitLeft = 162
    end
  end
end

【讨论】:

    【解决方案2】:

    父表单是否正确添加到 .dpr 中?

    【讨论】:

    • @Marco,是的,它们已添加到 dpr。
    猜你喜欢
    • 2010-10-15
    • 1970-01-01
    • 2011-05-28
    • 1970-01-01
    • 1970-01-01
    • 2010-10-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多