rm_insp.pas

来自「胜天进销存源码,国产优秀的进销存」· PAS 代码 · 共 1,244 行 · 第 1/3 页

PAS
1,244
字号
{ TDataSetEditor }

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

procedure TDataSetEditor.Edit;
var
  tmp: TRMBandEditorForm;
begin
  tmp := TRMBandEditorForm.Create(nil);
  try
    if tmp.ShowEditor(TRMView(GetInstance(0))) = mrOK then
      SetStrValue(TRMBandMasterData(GetInstance(0)).DataSetName);
  finally
    tmp.Free;
  end;
end;

{------------------------------------------------------------------------------}
{------------------------------------------------------------------------------}
{ TCrossDataBandDataSourceEditor }

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

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

{------------------------------------------------------------------------------}
{------------------------------------------------------------------------------}
{ TGroupConditionEditor }

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

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
  liStr: string;
begin
  liStr := RMDesigner.InsertDBField;
  if liStr <> '' then
    SetStrValue(liStr);
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;

{------------------------------------------------------------------------------}
{------------------------------------------------------------------------------}
{ TMethodEditor }

type
  PParamRecord = ^TParamRecord;
  TParamRecord = record
    Flags: TParamFlags;
    ParamName: ShortString;
    TypeName: ShortString;
  end;

procedure TMethodEditor.GetFuncParams(aParams: PRMParamRecArray; var aParamCount: Integer);
var
  i: Integer;
  lTypeData: PTypeData;
  lParamRecord: PParamRecord;
  lTypeStr: PShortString;
begin
  aParamCount := 0;
  lTypeData := TypInfo.GetTypeData(PropTypeInfo);
  lParamRecord := @lTypeData.ParamList;
	for i := 1 to lTypeData.ParamCount do
  begin
    lTypeStr := Pointer(Integer(@lParamRecord.ParamName) +
      Length(lParamRecord.ParamName) + 1);
    aParams[aParamCount].IsVar := pfVar in lParamRecord.Flags;
    aParams[aParamCount].IsConst := pfConst in lParamRecord.Flags;
    aParams[aParamCount].IsArray := pfArray in lParamRecord.Flags;
    aParams[aParamCount].ClassType := lTypeStr^;
    aParams[aParamCount].Name := lParamRecord.ParamName;
    Inc(aParamCount);

    lParamRecord := PParamRecord(Integer(lParamRecord) + SizeOf(TParamFlags) +
      (Length(lParamRecord^.ParamName) + 1) + (Length(lTypeStr^) + 1));
  end;
end;

function TMethodEditor.AllEqual: Boolean;
begin
  Result := False;
  if PropCount > 1 then
  begin
    Exit;
  end;
  Result := True;
end;

function TMethodEditor.GetValue: string;
var
  lValue: Variant;
begin
  lValue := TRMPersistent(GetInstance(0)).PropVars[PropName];
  if lValue <> Null then
    Result := lValue
  else
    Result := '';
end;

procedure TMethodEditor.SetValue(const Value: string);
begin
  TRMPersistent(GetInstance(0)).PropVars[PropName] := Value;
end;

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

procedure TMethodEditor.GetValues(AValues: TStrings);
var
  lParamCount: Integer;
  lParams: TRMParamRecArray;
begin
  aValues.Clear;

  GetFuncParams(@lParams, lParamCount);
  RMDesigner.GetEventFunctions(aValues, @lParams, lParamCount);
end;

procedure TMethodEditor.Edit;
var
  lFuncName, lNewFuncName: string;
  lParamCount: Integer;
  lParams: TRMParamRecArray;
begin
  lFuncName := GetValue;
  lNewFuncName := lFuncName;
  if lNewFuncName = '' then
    lNewFuncName := TRMPersistent(GetInstance(0)).Name + PropName;

  GetFuncParams(@lParams, lParamCount);
  RMDesigner.EditMethod(lNewFuncName, @lParams, lParamCount);
  if lNewFuncName <> lFuncName then
  begin
    SetValue(lNewFuncName);
    Modified;
  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

⌨️ 快捷键说明

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