• TdxBarButton的FASTSCRIPT封装


    TdxBarButton的FASTSCRIPT封装

    // cxg 2017-2-13

    unit fs_dev;

    interface
    {$i fs.inc}
    uses
    fs_iinterpreter, fs_itools, fs_ievents,
    fs_iclassesrtti, Variants,
    dxBar, cxClasses
    ;

    type
    TdxBarButtonRTTI = class(TdxBarButton); // fake component

    TfsNotifyEvent = class(TfsCustomEvent)
    public
    procedure DoEvent(Sender:TObject);
    function GetMethod: Pointer; override;
    end;

    type
    TdevFunctions = class(TfsRTTIModule)
    private
    function CallMethod(Instance: TObject; ClassType: TClass;
    const MethodName: String; Caller: TfsMethodHelper): Variant;
    function GetProp(Instance: TObject; ClassType: TClass;
    const PropName: String): Variant;
    procedure SetProp(Instance: TObject; ClassType: TClass;
    const PropName: String; Value: Variant);
    public
    constructor Create(AScript: TfsScript); override;
    end;

    implementation

    procedure TfsNotifyEvent.DoEvent(Sender: TObject);
    begin
    CallHandler([Sender]);
    end;

    function TfsNotifyEvent.GetMethod: Pointer;
    begin
    Result := @TfsNotifyEvent.DoEvent;
    end;

    constructor TdevFunctions.Create(AScript: TfsScript);
    begin
    inherited Create(AScript);
    with AScript do
    begin
    with AddClass(TdxBarButton, 'TdxBarButton') do
    begin
    AddEvent('OnClick', TfsNotifyEvent);
    end;
    end;
    end;

    function TdevFunctions.CallMethod(Instance: TObject; ClassType: TClass;
    const MethodName: String; Caller: TfsMethodHelper): Variant;
    begin
    end;

    function TdevFunctions.GetProp(Instance: TObject; ClassType: TClass;
    const PropName: String): Variant;
    begin
    end;

    procedure TdevFunctions.SetProp(Instance: TObject; ClassType: TClass;
    const PropName: String; Value: Variant);
    begin
    end;

    initialization
    fsRTTIModules.Add(TdevFunctions);
    finalization
    fsRTTIModules.Remove(TdevFunctions);

    end.

  • 相关阅读:
    iPhone 调用Web Service 例子(转)
    iPhone开发:在UIAlertView中显示进度条(转)
    Oracel 分页
    NYOJ 477
    NYOJ 108(数组中存的是前n个数的和)
    NYOJ 199
    NYOJ 311(完全背包)
    高效斐数(前92位)
    NYOJ 57(6174问题)
    NYOJ 546(分珠宝)
  • 原文地址:https://www.cnblogs.com/hnxxcxg/p/6392383.html
Copyright © 2020-2023  润新知