已发布的属性未在设计器中显示

时间:2017-06-28 12:34:10

标签: delphi firemonkey delphi-10.2-tokyo

在以前版本的Delphi中,我的自定义表单显示了已发布的属性。

但是,我遇到了Delphi 10.2 Tokyo的问题。具体来说,我没有看到调用this post中找到的适当方法的好方法。

总结一下,需要拨打RegisterCustomModule(),但在DesignIntf所述的here单元中,没有TCustomModuleTBaseCustomModule但是,基本自定义模块也继承自TCustomModuleClass,而TInterfacedObject没有(使用FMX作为我的框架)。{}}和TForm

注册FMX表格以在最新版本的Delphi中显示已发布属性的正确方法是什么?

1 个答案:

答案 0 :(得分:2)

uses DesignEditors;

type
   TMySpecialForm = class(TCustomForm)
   end;


RegisterCustomModule(TMySpecialForm, TCustomModule);

RegisterCustomModule有2个参数:ComponentBaseClassCustomModuleClass。第一个是您的自定义表单类,当然,它将派生自TCustomForm。第二个是设计师将使用的类。这个类必须做两件事:从TBaseCustomModule派生(在DesignIntf单元中)并实现ICustomModule接口。请查看第{502行附近DesignEditors单元中的评论。

如果您没有在设计时添加到自定义表单的默认行为,则提供TCustomModule类供您使用。

如果你想在设计师中想要某种形式的自定义行为,比如一个带有各种属性设置命令的弹出菜单,你可以创建自己的TCustomModule类:

uses DesignEditors;

type
    TMySpecialFormDesigner = class(TCustomModule, ICustomModule)
        function GetVerb(Index: Integer): string; override;
        function GetVerbCount: Integer; override;
    end;

RegisterCustomModule(TMySpecialForm, TMySpecialFormDesigner);
相关问题