⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frxclassrtti.pas

📁 报表源码 FastReport 3 is new generation of the report generators components. It consists of report engin
💻 PAS
📖 第 1 页 / 共 2 页
字号:
  end;
end;

destructor TFunctions.Destroy;
begin
  if fsGlobalUnit<>nil then
    fsGlobalUnit.RemoveItems(Self);
  inherited;
end;

function TFunctions.CallMethod(Instance:TObject; ClassType:TClass;
  const MethodName:String; var Params:Variant):Variant;
var
  _TfrxDataSet:TfrxDataSet;
begin
  Result:= 0;
  if ClassType = TfrxDataSet then
  begin
    _TfrxDataSet:= TfrxDataSet(Instance);
    if MethodName = 'OPEN' then
      _TfrxDataSet.Open
    else if MethodName = 'CLOSE' then
      _TfrxDataSet.Close
    else if MethodName = 'FIRST' then
      _TfrxDataSet.First
    else if MethodName = 'NEXT' then
      _TfrxDataSet.Next
    else if MethodName = 'PRIOR' then
      _TfrxDataSet.Prior
    else if MethodName = 'EOF' then
      Result:= _TfrxDataSet.Eof
    else if MethodName = 'FIELDSCOUNT' then
      Result:= _TfrxDataSet.FieldsCount
    else if MethodName = 'RECORDCOUNT' then
      Result:= _TfrxDataSet.RecordCount
    else if MethodName = 'HASFIELD' then
      Result:= _TfrxDataSet.HasField(Params[0])
    else if MethodName = 'ISBLOBFIELD' then
      Result:= _TfrxDataSet.IsBlobField(Params[0])
    else if MethodName = 'GETFIELDLIST' then
      _TfrxDataSet.GetFieldList(TStrings(Integer(Params[0])))
    else if MethodName = 'DISPLAYTEXT.GET' then
      Result:= _TfrxDataSet.DisplayText[Params[0]]
    else if MethodName = 'DISPLAYWIDTH.GET' then
      Result:= _TfrxDataSet.DisplayWidth[Params[0]]
    else if MethodName = 'FIELDTYPE.GET' then
      Result:= _TfrxDataSet.FieldType[Params[0]]
    else if MethodName = 'VALUE.GET' then
      Result:= _TfrxDataSet.Value[Params[0]]
  end
  else if ClassType = TfrxComponent then
  begin
    if MethodName = 'CLEAR' then
      TfrxComponent(Instance).Clear
    else if MethodName = 'FINDOBJECT' then
      Result:= Integer(TfrxComponent(Instance).FindObject(Params[0]))
    else if MethodName = 'LOADFROMSTREAM' then
      TfrxComponent(Instance).LoadFromStream(TStream(Integer(Params[0])))
    else if MethodName = 'SAVETOSTREAM' then
      TfrxComponent(Instance).SaveToStream(TStream(Integer(Params[0])), Params[1])
    else if MethodName = 'SETBOUNDS' then
      TfrxComponent(Instance).SetBounds(Params[0], Params[1], Params[2], Params[3])
  end
  else if ClassType = TfrxDialogControl then
  begin
    if MethodName = 'SETFOCUS' then
      if TfrxDialogControl(Instance).Control is TWinControl then
        TWinControl(TfrxDialogControl(Instance).Control).SetFocus;
  end
  else if ClassType = TfrxStretcheable then
  begin
    if MethodName = 'CALCHEIGHT' then
      Result:= TfrxStretcheable(Instance).CalcHeight
  end
  else if ClassType = TfrxCustomMemoView then
  begin
    if MethodName = 'CALCWIDTH' then
      Result:= TfrxCustomMemoView(Instance).CalcWidth
  end
  else if ClassType = TfrxPictureView then
  begin
    if MethodName = 'LOADFROMFILE' then
      TfrxPictureView(Instance).Picture.LoadFromFile(Params[0])
  end
  else if ClassType = TfrxDialogPage then
  begin
    if MethodName = 'SHOWMODAL' then
      Result:= TfrxDialogPage(Instance).ShowModal
  end
  else if ClassType = TfrxVariables then
  begin
    if MethodName = 'VARIABLES.GET' then
      Result:= TfrxVariables(Instance).Variables[Params[0]]
    else if MethodName = 'VARIABLES.SET' then
      TfrxVariables(Instance).Variables[Params[0]]:= Params[1]
  end
  else if ClassType = TfrxReport then
  begin
    if MethodName = 'CALC' then
      Result:= TfrxReport(Instance).Calc(Params[0])
    else if MethodName = 'GETDATASET' then
      Result:= Integer(TfrxReport(Instance).GetDataset(Params[0]))
    else if MethodName = 'LOADFROMFILE' then
      Result:= TfrxReport(Instance).LoadFromFile(Params[0])
    else if MethodName = 'SAVETOFILE' then
      TfrxReport(Instance).SaveToFile(Params[0])
    else if MethodName = 'SHOWREPORT' then
      TfrxReport(Instance).ShowReport
  end
  else if ClassType = TfrxCustomEngine then
  begin
    if MethodName = 'ADDANCHOR' then
      TfrxPreviewPages(TfrxCustomEngine(Instance).PreviewPages).AddAnchor(Params[0])
    else if MethodName = 'GETANCHORPAGE' then
      Result:= TfrxPreviewPages(TfrxCustomEngine(Instance).PreviewPages).GetAnchorPage(Params[0])
    else if MethodName = 'NEWPAGE' then
      TfrxCustomEngine(Instance).NewPage
    else if MethodName = 'NEWCOLUMN' then
      TfrxCustomEngine(Instance).NewColumn
    else if MethodName = 'FREESPACE' then
      Result:= TfrxCustomEngine(Instance).FreeSpace
    else if MethodName = 'SHOWBAND' then
      TfrxCustomEngine(Instance).ShowBand(TfrxBand(Integer(Params[0])))
    else if MethodName = 'STOPREPORT' then
      TfrxCustomEngine(Instance).StopReport
  end
  else if ClassType = TfrxCustomOutline then
  begin
    if MethodName = 'ADDITEM' then
      TfrxCustomOutline(Instance).AddItem(Params[0],
        Round(TfrxCustomOutline(Instance).Engine.CurY))
    else if MethodName = 'LEVELROOT' then
      TfrxCustomOutline(Instance).LevelRoot
    else if MethodName = 'LEVELUP' then
      TfrxCustomOutline(Instance).LevelUp
  end
  else if MethodName = 'DAYOF' then
    Result:= StrToInt(FormatDateTime('d', Params[0]))
  else if MethodName = 'MONTHOF' then
    Result:= StrToInt(FormatDateTime('m', Params[0]))
  else if MethodName = 'YEAROF' then
    Result:= StrToInt(FormatDateTime('yyyy', Params[0]))
end;

function TFunctions.GetProp(Instance:TObject; ClassType:TClass;
  const PropName:String):Variant;
begin
  Result:= 0;

  if ClassType = TfrxDataSet then
  begin
    if PropName = 'RECNO' then
      Result:= TfrxDataSet(Instance).RecNo
  end
  else if ClassType = TfrxComponent then
  begin
    if PropName = 'OBJECTS' then
      Result:= Integer(TfrxComponent(Instance).Objects)
    else if PropName = 'ALLOBJECTS' then
      Result:= Integer(TfrxComponent(Instance).AllObjects)
    else if PropName = 'PARENT' then
      Result:= Integer(TfrxComponent(Instance).Parent)
    else if PropName = 'PAGE' then
      Result:= Integer(TfrxComponent(Instance).Page)
    else if PropName = 'ABSLEFT' then
      Result:= TfrxComponent(Instance).AbsLeft
    else if PropName = 'ABSTOP' then
      Result:= TfrxComponent(Instance).AbsTop
  end
  else if ClassType = TfrxCustomMemoView then
  begin
    if PropName = 'TEXT' then
      Result:= TfrxMemoView(Instance).Text
    else if PropName = 'LINES' then
      Result:= Integer(TfrxMemoView(Instance).Memo)
    else if PropName = 'VALUE' then
      Result:= TfrxMemoView(Instance).Value
  end
  else if ClassType = TfrxBand then
  begin
    if PropName = 'OVERFLOW' then
      Result:= TfrxBand(Instance).Overflow
  end
  else if ClassType = TfrxDialogPage then
  begin
    if PropName = 'MODALRESULT' then
      Result:= TfrxDialogPage(Instance).ModalResult
  end
  else if ClassType = TfrxReport then
  begin
    if PropName = 'TERMINATED' then
      Result:= TfrxReport(Instance).Terminated
  end
end;

procedure TFunctions.SetProp(Instance:TObject; ClassType:TClass;
  const PropName:String; Value:Variant);
begin
  if ClassType = TfrxComponent then
  begin
    if PropName = 'PARENT' then
      TfrxComponent(Instance).Parent:= TfrxComponent(Integer(Value))
  end
  else if ClassType = TfrxCustomMemoView then
  begin
    if PropName = 'TEXT' then
      TfrxMemoView(Instance).Text:= Value
    else if PropName = 'LINES' then
      TfrxMemoView(Instance).Memo.Assign(TStrings(Integer(Value)));
  end
  else if ClassType = TfrxDialogPage then
  begin
    if PropName = 'MODALRESULT' then
      TfrxDialogPage(Instance).ModalResult:= Value
  end
  else if ClassType = TfrxReport then
  begin
    if PropName = 'TERMINATED' then
      TfrxReport(Instance).Terminated:= Value
  end
end;

initialization
  Functions:= TFunctions.Create;

finalization
  Functions.Free;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -