unigui控件的FASTSCRIPT封装

unigui控件的FASTSCRIPT封装

unit fs_uniControl;

interface
{$i fs.inc}
uses
fs_iinterpreter, fs_itools, fs_ievents,
fs_iclassesrtti,System.Variants,
uniMainMenu,uniPageControl;

type
TuniMenuItemRTTI = class(TUniMenuItem); // fake component

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

type
TuniFunctions = 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;
VAR uniFunctions:TuniFunctions;
implementation
{ TFunctions }


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

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

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

with AddClass(TUniTabSheet, 'TUniTabSheet') do
begin

end;
end;
end;

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

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

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

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

end.

posted @ 2017-02-13 08:10  delphi中间件  阅读(1215)  评论(0编辑  收藏  举报