【问题标题】:How to create new IOTAComponent on Delphi form如何在 Delphi 表单上创建新的 IOTAComponent
【发布时间】:2013-07-08 20:47:51
【问题描述】:

我正在尝试编写 Delphi Open Tools API 工具来自动生成和更新放置在数据模块或表单上的组件。我已经可以列出所有组件(每个组件都由 IOTAComponent 的(类)实例表示)并修改它们的属性(setPropByName(...)、getPropValueByName(...))。问题是 - 如何在 Open Tools API 代码中创建新组件,以便将该组件添加到数据模块的形式中?

我正在使用 API 的 IOTAModuleServices 部分,我想这是手头任务的正确部分,不是吗?

【问题讨论】:

    标签: delphi form-designer opentools


    【解决方案1】:

    您需要获取要更新的Form/DataModule的IOTAFormEditor接口,然后调用其CreateComponent()方法:

    type
      IOTAFormEditor = interface(IOTAEditor)
        ['{F17A7BD2-E07D-11D1-AB0B-00C04FB16FB3}']
        ...
        function CreateComponent(const Container: IOTAComponent;
          const TypeName: string; X, Y, W, H: Integer): IOTAComponent;
        ...
      end;
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2010-11-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多