zoukankan      html  css  js  c++  java
  • Delphi中Frame的使用方法(2)

    Frame在写代码时和一般组件有什么不同呢?比如(1)中的客户信息的frame,如果想重写客户编辑按钮的click事件,会发生什么呢:

    procedure TBusOnSiteManager.FrameCustomerButtonEditCustomerClick(Sender: TObject);
    begin
      inherited;
      FrameCustomer.ButtonEditCustomerClick(Sender);

    end;


    可见,IDE会自动加上调用Frame中按钮click的方法,当然,你可以注释掉它,写上自己的代码。

    因为Frame没有自己的构造器和解析器,如果你想初始化一些东西,可以override frame的以下两个方法:

      public
        { Public declarations }
        procedure AfterConstruction; override;   //类似OnCreate事件
        procedure BeforeDestruction; override; //类型OnDestroy事件
      end;

    procedure TFrameCustomer.AfterConstruction;
    begin
      inherited;
      ParentForm := GetOwner as TTAppSQLForm;  //此处取得父窗口
    end;

    procedure TFrameCustomer.BeforeDestruction;
    begin
      inherited;

    end;

  • 相关阅读:
    Python方法
    Cpp求PI
    Asp.net身份验证和授权
    [转] 魔兽系列事件报道
    directxsdk aug 2006
    [转]转变的开始!NVIDIA更换新Logo
    wxWidgets 2.7.0 released
    OpenGL 和 Vista(续)
    暴雪员工的跳槽纪录
    3D版的星际争霸
  • 原文地址:https://www.cnblogs.com/h2zZhou/p/5371943.html
Copyright © 2011-2022 走看看