• [翻译]Component Registration in Script System 在脚本系统中注册组件


    Component Registration in Script System 在脚本系统中注册组件

    To refer to our component from a script, the class, its properties and methods must first be registered in the script system. You may place the registration code in a file with the same name as the component code file, with an added 'RTTI' suffix (frxBitBtnRTTI.pas in our case). See more about classes, registration, methods and properties in the FastScript script library documentation.

    要从脚本中引用我们的自己写的组件,该组件的类,属性和方法必须先注册在脚本系统中。你可以把注册代码放在相同名称的文件中作为组件的代码文件,添加的RTTI的后缀(frxbitbtnrtti.pas在我们这个例子中)。更多关于类,注册,方法和属性,请查看FastScript 脚本库文档。

    uses fs_iinterpreter, frxBitBtn, frxClassRTTI;

    type

    TFunctions = class(TfsRTTIModule)

    public

    constructor Create(AScript: TfsScript); override;

    end;

    constructor TFunctions.Create(AScript: TfsScript);

    begin

    inherited Create(AScript);

    with AScript do

    begin

    { register class and then define its parent }

    AddClass(TfrxBitBtnControl, 'TfrxDialogControl');

    { if there are several common controls in your unit,they can be registered here;

    for example, AddClass(TfrxAnotherControl, 'TfrxDialogControl'); }

    end;

    end;

    initialization

    fsRTTIModules.Add(TFunctions);

    finalization
      fsRTTIModules.Remove(TFunctions);

    end.

    可以参考 fs_imenusrtti.pas 单元

  • 相关阅读:
    excel生成数据地图
    利用web of science做论文综述
    机器学习算法一览图
    什么是机器学习?
    机器学习十大算法(二)
    机器学习十大算法(一)
    django传值出现二进制乱码(基于python3)
    解决mysql的动态添加字段以及数据的方法(基于python3.6)
    odoo权限控制
    win32service的解决办法(pywin32)
  • 原文地址:https://www.cnblogs.com/moon25/p/5530875.html
Copyright © 2020-2023  润新知