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.