Einzelnen Beitrag anzeigen

Benutzerbild von geskill
geskill

Registriert seit: 17. Feb 2007
Ort: NRW
420 Beiträge
 
Delphi 2010 Professional
 
#8

Re: FastScript - dem Script ein Interface hinzufügen

  Alt 30. Dez 2009, 17:36
Aber egal wie ich es drehe:
Programm kommt nicht mal in GetProp :(

Delphi-Quellcode:
function TTemplateParser.GetProp(Instance: TObject; ClassType: TClass; const PropName: String): Variant;
begin
  Result := 0;
  if PropName = 'MirrorCountthen
    Result := IMirrorController(Instance as TMirrorController).MirrorCount;
end;

function TTemplateParser.Exec(s: string): string;
begin
  Result := '';

  with FfsScript do
  begin
    with AddClass(TMirrorController, 'TMirrorController') do
    // with AddClass(TMirrorController, 'TInterfacedObject') do // geht genauso wenig
    begin
      AddProperty('MirrorCount', 'Integer', GetProp, nil);
    end;

    AddObject('IMirrorController', FITabSheetController.MirrorController as TMirrorController);
ScriptCode z.b.:
Code:
ShowMessage(IntToStr(IMirrorController.MirrorCount));
Sebastian
  Mit Zitat antworten Zitat