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

📄 rm_insp.pas

📁 这是一个功能强大
💻 PAS
📖 第 1 页 / 共 3 页
字号:
procedure TGroupConditionEditor.Edit;
var
  tmp: TRMGroupEditorForm;
begin
  tmp := TRMGroupEditorForm.Create(nil);
  try
    tmp.ShowEditor(TRMView(GetInstance(0)));
  finally
    tmp.Free;
  end;
end;

{------------------------------------------------------------------------------}
{------------------------------------------------------------------------------}
{ TExpressionEditor }

function TExpressionEditor.GetAttrs: TELPropAttrs;
begin
  Result := [praDialog];
end;

procedure TExpressionEditor.Edit;
var
  lStr: string;
begin
  lStr := GetStrValue(0);
  if RM_EditorExpr.RMGetExpression('', lStr, nil, False) then
  begin
    if lStr <> '' then
    begin
      if not ((lStr[1] = '[') and (lStr[Length(lStr)] = ']') and
        (Pos('[', Copy(lStr, 2, 999999)) = 0)) then
        lStr := '[' + lStr + ']';
    end;

    SetStrValue(lStr);
  end;
end;

{------------------------------------------------------------------------------}
{------------------------------------------------------------------------------}
{ TCalcOptionsEditor }

function TCalcOptionsEditor.GetAttrs: TELPropAttrs;
begin
  Result := [praMultiSelect, praSubProperties, praDialog, praReadOnly];
end;

procedure TCalcOptionsEditor.Edit;
var
  tmp: TRMCalcMemoEditorForm;
begin
  tmp := TRMCalcMemoEditorForm.Create(nil);
  try
    tmp.ShowEditor(TRMView(GetInstance(0)));
  finally
    tmp.Free;
  end;
end;

{------------------------------------------------------------------------------}
{------------------------------------------------------------------------------}
{ THighlightEditor }

function THighlightEditor.GetAttrs: TELPropAttrs;
begin
  Result := [praMultiSelect, praSubProperties, praDialog, praReadOnly];
end;

procedure THighlightEditor.Edit;
var
  tmp: TRMHilightForm;
begin
  tmp := TRMHilightForm.Create(nil);
  try
    tmp.ShowEditor(TRMView(GetInstance(0)));
  finally
    tmp.Free;
  end;
end;

{------------------------------------------------------------------------------}
{------------------------------------------------------------------------------}
{ TShiftWithEditor }

function TShiftWithEditor.GetAttrs: TELPropAttrs;
begin
  Result := [praMultiSelect, praValueList, praSortList];
end;

procedure TShiftWithEditor.GetValues(aValues: TStrings);
var
  i, j: Integer;
  t: TRMView;
  liParentBand: TRMView;
  lList: TList;
begin
  lList := RMDesigner.PageObjects;
  t := TRMView(GetInstance(0));
  for i := 0 to lList.Count - 1 do
  begin
    liParentBand := lList[i];
    if (t.spTop >= liParentBand.spTop) and (t.spBottom <= liParentBand.spBottom) then
    begin
      for j := 0 to lList.Count - 1 do
      begin
        t := lList[j];
        if THackView(t).Stretched and (t is TRMStretcheableView) and (GetInstance(0) <> t) and
          (t.spTop >= liParentBand.spTop) and (t.spBottom <= liParentBand.spBottom) then
          aValues.Add(t.Name);
      end;
      Break;
    end;
  end;
end;

{------------------------------------------------------------------------------}
{------------------------------------------------------------------------------}
{ TMasterMemoViewEditor }

function TMasterMemoViewEditor.GetAttrs: TELPropAttrs;
begin
  Result := [praMultiSelect, praValueList, praSortList];
end;

procedure TMasterMemoViewEditor.GetValues(aValues: TStrings);
var
  i: Integer;
  t: TRMView;
  lList: TList;
begin
  lList := RMDesigner.PageObjects;
  for i := 0 to lList.Count - 1 do
  begin
    t := lList[i];
    if (t is TRMCustomMemoView) and (GetInstance(0) <> t) then
      aValues.Add(t.Name);
  end;
end;

{------------------------------------------------------------------------------}
{------------------------------------------------------------------------------}
{ TPictureView_PictureEditor }

function TPictureView_PictureEditor.GetAttrs: TELPropAttrs;
begin
  Result := [praMultiSelect, praSubProperties, praDialog, praReadOnly];
end;

procedure TPictureView_PictureEditor.Edit;
var
  tmp: TRMPictureEditorForm;
begin
  tmp := TRMPictureEditorForm.Create(nil);
  try
    tmp.ShowEditor(TRMView(GetInstance(0)));
  finally
    tmp.Free;
  end;
end;

{------------------------------------------------------------------------------}
{------------------------------------------------------------------------------}
{ TPageBackPictureEditor }

function TPageBackPictureEditor.GetAttrs: TELPropAttrs;
begin
  Result := [praSubProperties, praDialog, praReadOnly];
end;

procedure TPageBackPictureEditor.Edit;
var
  tmp: TRMPictureEditorForm;
begin
  tmp := TRMPictureEditorForm.Create(nil);
  try
    tmp.ShowbkPicture(TRMReportPage(GetInstance(0)));
  finally
    tmp.Free;
  end;
end;

{------------------------------------------------------------------------------}
{------------------------------------------------------------------------------}
{ TDataFieldEditor }

function TDataFieldEditor.GetAttrs: TELPropAttrs;
begin
  Result := [praMultiSelect, praDialog];
end;

procedure TDataFieldEditor.Edit;
var
  lStr: string;
begin
  lStr := RMDesigner.InsertDBField(TRMView(GetInstance(0)));
  if lStr <> '' then
    SetStrValue(lStr);
end;

{------------------------------------------------------------------------------}
{------------------------------------------------------------------------------}
{ TDisplayFormatEditor }

type
  THackMemoView = class(TRMCustomMemoView)
  end;

function TDisplayFormatEditor.GetAttrs: TELPropAttrs;
begin
  Result := [praDialog, praMultiSelect];
end;

procedure TDisplayFormatEditor.Edit;
var
  t: TRMView;
  tmp: TRMDisplayFormatForm;
begin
  t := TRMView(GetInstance(0));
  if not (t is TRMCustomMemoView) then Exit;

  tmp := TRMDisplayFormatForm.Create(nil);
  try
    tmp.ShowEditor(t);
  finally
    tmp.Free;
  end;
end;

{------------------------------------------------------------------------------}
{------------------------------------------------------------------------------}

function TMethodEditor.GetAttrs: TELPropAttrs;
begin
  Result := [praMultiSelect, praDialog, praValueList, praSortList, praMethodProp];
end;

procedure TMethodEditor.Edit;
var
  t: TObject;
  ts, s, OldFunName, FunName: string;
begin
  t := GetInstance(0);
  s := '%s_%s';
  OldFunName := Value;
  FunName := OldFunName;
  if FunName = '' then
  begin
    if t is TRMPersistent then
      ts := TRMPersistent(t).Name
    else if t is TRMReport then
      ts := 'Report'
    else if t is TComponent then
      ts := TComponent(t).Name;

    FunName := Format(s, [ts, PropName]);
  end;
  Value := FunName;
end;

procedure TMethodEditor.GetValues(AValues: TStrings);
begin
  RMDesigner.GetMethodsList(PropTypeInfo, AValues);
end;

function TMethodEditor.GetValue: string;
var
  t: TPersistent;
begin
  t := GetInstance(0);

  Result := FCurReport.ReportEventVars.GetEventPropVar(t, PropName);
end;

procedure TMethodEditor.SetValue(const Value: string);
var
  t: TPersistent;
  lPropInf: PPropInfo;
  lFunName, lOldValue: string;
  lDefine: string;
  lsPropName: string;
  lSelObjList: TList;
  i: integer;

  procedure _DoSetPropEvent;
  var
    j: integer;
  begin
    if SameText(lOldValue, Value) then Exit;
    for j := 0 to lSelObjList.Count - 1 do
    begin
      t := lSelObjList[j];
      FCurReport.ReportEventVars.SetEventPropVar(t, lsPropName, lFunName)
    end;
    Modified;
  end;

begin //dejoy
  lOldValue := Self.Value;
  t := GetInstance(0);
  lFunName := Value;
  lPropInf := GetPropInfo(0);
  lsPropName := PropName;

  if (lPropInf.PropType^.Kind <> tkMethod) then
    Exit;
  if SameText(lOldValue, lFunName) then
  begin
    RMDesigner.GotoMethod(lFunName);
    Exit;
  end;
  lSelObjList := TList.Create;
  try

    for i := 0 to PropCount - 1 do
      lSelObjList.Add(GetInstance(i));

    if Trim(lFunName) <> '' then
    begin
      lDefine := GetMethodDefinition(PropTypeInfo);
      Insert(Value, lDefine, Pos('(', lDefine));

      if not RMDesigner.FunctionExists(lFunName) then //事件函数代码不存在
      begin
        if (lOldValue = '') then //原事件函数未赋值,则新增代码
        begin
          if RMDesigner.DefineMethod(lFunName, lDefine) then
          begin
            RMDesigner.GotoMethod(lFunName);
          end;
        end
        else //原事件函数已赋值则改名
        begin
          RMDesigner.RenameMethod(lOldValue, lFunName);
          FCurReport.ReportEventVars.RenameEventProc(lOldValue, lFunName);
        end;
      end;
    end;

    _DoSetPropEvent;

  finally
    lSelObjList.Free;
  end;

end;


function TMethodEditor.AllEqual: Boolean;
var
  LI: Integer;
  t: TPersistent;
  lpropName, LV: string;
begin
  Result := True;
  lpropName := PropName;
  t := GetInstance(0);
  LV := FCurReport.ReportEventVars.GetEventPropVar(t, lpropName);

  if PropCount > 1 then
    for LI := 1 to PropCount - 1 do
      with FCurReport.ReportEventVars do
        if not SameText(GetEventPropVar(GetInstance(LI), lpropName), Lv) then
        begin
          Result := False;
          Break;
        end;

end;

{------------------------------------------------------------------------------}
{------------------------------------------------------------------------------}
{ TPicturePropEditor }

function TPicturePropEditor.GetAttrs: TELPropAttrs;
begin
  Result := [praMultiSelect, praDialog, praReadOnly];
end;

procedure TPicturePropEditor.Edit;
var
  tmp: TRMPictureEditorForm;
begin
  tmp := TRMPictureEditorForm.Create(nil);
  try
    tmp.Picture := TPicture(GetOrdValue(0));
    if tmp.ShowModal = mrOK then
      SetOrdValue(Longint(tmp.Picture));
  finally
    tmp.Free;
  end;
end;

{------------------------------------------------------------------------------}
{------------------------------------------------------------------------------}
{ TBitmapPropEditor }

function TBitmapPropEditor.GetAttrs: TELPropAttrs;
begin
  Result := [praMultiSelect, praDialog, praReadOnly];
end;

procedure TBitmapPropEditor.Edit;
var
  tmp: TRMPictureEditorForm;
begin
  tmp := TRMPictureEditorForm.Create(nil);
  try
    tmp.PictureTypes := ' (*.bmp)|*.bmp';
    tmp.Picture.Assign(TBitmap(GetOrdValue(0)));
    if tmp.ShowModal = mrOK then
      SetOrdValue(Longint(tmp.Picture.Bitmap));
  finally
    tmp.Free;
  end;
end;

{------------------------------------------------------------------------------}
{------------------------------------------------------------------------------}
{ TReportView_SubReportEditor }

function TReportView_SubReportEditor.GetAttrs: TELPropAttrs;
begin
  Result := [praMultiSelect, praValueList, praSortList];
end;

procedure TReportView_SubReportEditor.GetValues(aValues: TStrings);
var
  i: Integer;
  t: TRMView;
  lList: TList;
begin
  lList := RMDesigner.PageObjects;
  for i := 0 to lList.Count - 1 do
  begin
    t := lList[i];
    if (t is TRMSubReportView) and (TRMSubReportView(t).SubReportType = rmstChild) then
      aValues.Add(t.Name);
  end;
end;

{------------------------------------------------------------------------------}
{------------------------------------------------------------------------------}
{ TStyleNameEditor }

function TStyleNameEditor.GetAttrs: TELPropAttrs;
begin
  Result := [praMultiSelect, praValueList, praSortList];
end;

procedure TStyleNameEditor.GetValues(aValues: TStrings);
var
  lReport: TRMReport;
  i: Integer;
begin
  lReport := THackView(GetInstance(0)).ParentReport;
  for i := 0 to lReport.TextStyles.Count - 1 do
  begin
    aValues.Add(lReport.TextStyles[i].StyleName);

⌨️ 快捷键说明

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