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

📄 sctreg.pas

📁 suite component ace report
💻 PAS
📖 第 1 页 / 共 2 页
字号:

procedure TSctTotalVarProperty.SetValue(const Value: string);
var
  J: Integer;
  Comp: TComponent;
  pg: TSctPage;
  list: TList;
  myVal: String;
begin
  if Value = '' then Comp := nil else
  begin
  if GetComponent(0) is TSctGroup Then pg := TSctPage(TSctGroup(GetComponent(0)).Page)
    else if GetComponent(0) is TSctLabel Then pg := TSctPage(TSctLabel(GetComponent(0)).page)
    else if GetComponent(0) is TSctvar Then pg := TSctPage(TSctvar(GetComponent(0)).parent)
    else raise Exception.Create('variable property editor can not find page');

    myVal := UpperCase(Value);
    Comp := nil;
    list := pg.varlist;
    if list <> nil then
    begin
      for J := 0 to (list.Count - 1) do
      begin
        if uppercase(TSctvar(list.Items[J]).Name) = myVal Then
        begin
          if (TSctvar(list.Items[J]) is TSctTotalvar) Then
             Comp := list.Items[J]
          else
            raise Exception.Create('You must assign a Total Variable.');
        end;
      end;
    end;

    if Comp = nil Then
      raise EPropertyError.Create('Invalid Property');
  end;

  SetOrdValue(Longint(Comp));

end;

{ TSctLevelProperty }
function TSctLevelProperty.GetValue: string;
var
  Component: TComponent;
begin
  Component := TComponent(GetOrdValue);
  if Component = nil then Result := ''
  else Result := TSctLevel(Component).Name;
end;

procedure TSctLevelProperty.GetValues(Proc: TGetStrProc);
var
  I: Integer;
  Component: TComponent;
  pg: TSctPage;
begin
  if GetComponent(0) is TSctBand Then pg := TSctPage(TSctBand(GetComponent(0)).Page)
  else if GetComponent(0) is TSctLabel Then pg := TSctPage(TSctLabel(GetComponent(0)).Page)
  else if GetComponent(0) is TSctvar Then pg := TSctPage(TSctvar(GetComponent(0)).Parent)
  else if GetComponent(0) is TSctDataSourceGuide Then pg := TSctPage(TSctDataSourceGuide(GetComponent(0)).Parent)
  else raise Exception.Create('variable property editor can not find page');

  for I := 0 to Designer.Form.ComponentCount - 1 do
  begin
    Component := Designer.Form.Components[I];
    if (Component is TSctLevel) and (Component.Name <> '') then
    begin
      if TSctLevel(Component).Page = pg Then Proc( TSctLevel(Component).Name);
    end;
  end;
end;

procedure TSctLevelProperty.SetValue(const Value: string);
var
  myVal: String;
  I: Integer;
  Component,Comp2: TComponent;
  pg: TSctPage;
begin
  if GetComponent(0) is TSctBand Then pg := TSctPage(TSctBand(GetComponent(0)).Page)
  else if GetComponent(0) is TSctLabel Then pg := TSctPage(TSctLabel(GetComponent(0)).Page)
  else if GetComponent(0) is TSctvar Then pg := TSctPage(TSctvar(GetComponent(0)).Parent)
  else if GetComponent(0) is TSctDataSourceGuide Then pg := TSctPage(TSctDataSourceGuide(GetComponent(0)).Parent)
  else raise Exception.Create('variable property editor can not find page');

  if Value = '' then Component := nil else
  begin
    myVal := UpperCase(Value);
    Component := nil;

    for I := 0 to Designer.Form.ComponentCount - 1 do
    begin
      Comp2 := Designer.Form.Components[I];
      if (Comp2 is TSctLevel) then
      begin
        if TSctLevel(Comp2).Page = pg Then
          if uppercase(TSctLevel(Comp2).Name) = myVal Then Component := Comp2;
      end;
    end;

    if Component = nil Then
      raise EPropertyError.Create('Invalid Property');
  end;

  SetOrdValue(Longint(Component));

end;

{ TSctTotalLevelProperty }
function TSctTotalLevelProperty.GetValue: string;
var
  Component: TComponent;
begin
  Component := TComponent(GetOrdValue);
  if Component = nil then Result := ''
  else Result := TSctLevel(Component).Name;
end;

procedure TSctTotalLevelProperty.GetValues(Proc: TGetStrProc);
var
  I: Integer;
  Component: TComponent;
  pg: TSctPage;
begin
  if GetComponent(0) is TSctBand Then pg := TSctPage(TSctBand(GetComponent(0)).Page)
  else if GetComponent(0) is TSctLabel Then pg := TSctPage(TSctLabel(GetComponent(0)).Page)
  else if GetComponent(0) is TSctvar Then pg := TSctPage(TSctvar(GetComponent(0)).Parent)
  else if GetComponent(0) is TSctDataSourceGuide Then pg := TSctPage(TSctDataSourceGuide(GetComponent(0)).Parent)
  else raise Exception.Create('variable property editor can not find page');

  for I := 0 to Designer.Form.ComponentCount - 1 do
  begin
    Component := Designer.Form.Components[I];
    if (Component is TSctLevel) and (Component.Name <> '') then
    begin
      if (TSctLevel(Component).Page = pg) And Not (TSctLevel(Component).IsHeader)
                 Then Proc( TSctLevel(Component).Name);
    end;
  end;
end;

procedure TSctTotalLevelProperty.SetValue(const Value: string);
var
  myVal: String;
  I: Integer;
  Component,Comp2: TComponent;
  pg: TSctPage;
begin
  if GetComponent(0) is TSctBand Then pg := TSctPage(TSctBand(GetComponent(0)).Page)
  else if GetComponent(0) is TSctLabel Then pg := TSctPage(TSctLabel(GetComponent(0)).Page)
  else if GetComponent(0) is TSctvar Then pg := TSctPage(TSctvar(GetComponent(0)).Parent)
  else if GetComponent(0) is TSctDataSourceGuide Then pg := TSctPage(TSctDataSourceGuide(GetComponent(0)).Parent)
  else raise Exception.Create('variable property editor can not find page');

  if Value = '' then Component := nil else
  begin
    myVal := UpperCase(Value);
    Component := nil;

    for I := 0 to Designer.Form.ComponentCount - 1 do
    begin
      Comp2 := Designer.Form.Components[I];
      if (Comp2 is TSctLevel) then
      begin
        if (TSctLevel(Comp2).Page = pg) And Not (TSctLevel(Comp2).IsHeader) Then
          if uppercase(TSctLevel(Comp2).Name) = myVal Then Component := Comp2;
      end;
    end;

    if Component = nil Then
      raise EPropertyError.Create('Invalid Property');
  end;

  SetOrdValue(Longint(Component));

end;


{ TSctReadOnlySubProperty }
function TSctReadOnlySubProperty.GetAttributes: TPropertyAttributes;
begin
  Result := [paSubProperties, paReadOnly];
end;

{ TSctDataSetProperty }
{$ifdef AceBDE}
function TSctDataSetProperty.GetValue: string;
var
  Component: TComponent;
begin
  Component := TComponent(GetOrdValue);
  if Component = nil then Result := ''
  else Result := TDataSet(Component).Name;
end;

procedure TSctDataSetProperty.GetValues(Proc: TGetStrProc);
begin
  ShowMessage('Dataset is no longer being supported, use the DataSource property instead');
end;

procedure TSctDataSetProperty.SetValue(const Value: string);
begin
  if Value = '' then SetOrdValue(Longint(nil));
end;

{ TSctDataSourceDSGProperty }
function TSctDataSourceDSGProperty.GetAttributes: TPropertyAttributes;
begin
  Result := [paSubProperties, paReadOnly];
end;

function TSctDataSourceDSGProperty.GetValue: string;
var
  dsg: TSctDataSourceGuide;
  ds: TDataSource;
begin
  result := inherited GetValue;
  { if the datasource is nil force it to delete itself }
  dsg := TSctDataSourceGuide(GetComponent(0));
  ds := dsg.DataSource;
  if ds = nil then Result := Result;
end;
{$endif}

{ TSctReserveBandProperty }
{function TSctReserveBandProperty.GetValue: string;
var
  Component: TComponent;
begin
  Component := TComponent(GetOrdValue);
  if Component = nil then Result := ''
  else Result := TSctBand(Component).Name;
end;

procedure TSctReserveBandProperty.GetValues(Proc: TGetStrProc);
var
  I: Integer;
  pg: TSctPage;
  Component: TComponent;
begin
  ShowMessage('hi');
  pg := TSctReserveSpace(GetComponent(0)).Band.Parent as TSctPage;

  for I := 0 to Designer.Form.ComponentCount - 1 do
  begin
    Component := Designer.Form.Components[I];
    if (Component is TSctBand) and (Component.Name <> '') then
    begin
      if TSctBand(Component).Parent = pg Then Proc( TSctBand(Component).Name);
    end;
  end;
end;

procedure TSctReserveBandProperty.SetValue(const Value: string);
var
  MyName: String;
  Component: TComponent;
  pg: TSctPage;
  Spot: Integer;
begin
  pg := TSctReserveSpace(GetComponent(0)).Band.Parent as TSctPage;

  if Value = '' then SetOrdValue(Longint(nil))
  else
  begin
    MyName := UpperCase(Value);
    Component := nil;

    Spot := 0;
    while Spot < Designer.Form.ComponentCount do
    begin
      Component := Designer.Form.Components[Spot];
      if Component.Name = MyName then
      begin
        if (Component is TSctBand) then
        begin
          if TSctBand(Component).Parent = pg Then
          begin
            SetOrdValue(Longint(Component));
            Spot := Designer.Form.ComponentCount;
          end;
        end;
      end;
      Component := nil;
      Inc(Spot);
    end;

    if Component = nil Then
      raise EPropertyError.Create('Invalid Property');
  end;


end;
}


{ Register }
procedure Register;
begin

  { SctCtrl }
  RegisterComponents('AceReporter', [TSctvarlabel,
                  TSctTotalvarLabel, TSctLine, TSctShape, TSctImageLabel
                  , TSctVerticalDivider, TSctCheckLabel, TSctBarCodeLabel
                  , TSctCustomLabel]);


  RegisterComponentEditor(TSctLabel, TSctLabelEditor);


  { sctbtn }
  RegisterComponents('AceReporter', [TSctReportButton]);


  { AceRtfC}
  {$ifdef WIN32}
  RegisterComponents('AceReporter', [TSctRichTextLabel]);
  {$endif}

  { sctrep }
  registerComponents('AceReporter', [ sctrep.TSctReport ]);

  RegisterNoIcon([TSctTextLabel,TSctGroup, TSctPage, TSctBand, TSctSubBand
                 , TSctSubDataBand, TSctGrouppage, TSctDataSourceGuide
                 , TSctDataHeadBand, TSctDataFootBand, TSctOverLayBand]);

  RegisterClasses([TSctTextLabel,TSctGroup, TSctPage, TSctBand, TSctSubBand
                 , TSctSubDataBand, TSctGrouppage, TSctDataSourceGuide
                 , TSctDataHeadBand, TSctDataFootBand, TSctOverLayBand]);


{$ifdef AceBDE}
  RegisterPropertyEditor(TypeInfo(TDataSet),TSctGroupPage,'',TSctDataSetProperty);
  RegisterPropertyEditor(TypeInfo(TDataSet),TSctSubDataBand,'',TSctDataSetProperty);
{$endif}


  { sctvar }
{  RegisterComponents('AceReporter', [TSctGlobalVar]);}

  RegisterClasses([TSctLevel, TSctExprvar, TSctTotalvar,
        TSctDateTimeVar, TSctPageVar]);
{$ifdef AceBDE}
  RegisterClasses([TSctdbVar]);
{$endif}


  RegisterNoIcon([TSctLevel, TSctExprvar, TSctTotalvar]);
{$ifdef AceBDE}
  RegisterNoIcon([TSctdbvar]);
{$endif}



 { sctreg }
  RegisterComponentEditor(TSctGrouppage, TSctGrouppageEditor);

  RegisterPropertyEditor(TypeInfo(TSctvar), nil, '', TSctVarProperty);
  RegisterPropertyEditor(TypeInfo(TSctTotalvar), nil, '', TSctTotalVarProperty);
  RegisterPropertyEditor(TypeInfo(TSctLevel), nil, '', TSctLevelProperty);
  RegisterPropertyEditor(TypeInfo(TSctLevel), TSctTotalVarLabel, 'level', TSctTotalLevelProperty);

  RegisterPropertyEditor(TypeInfo(TSctBand),nil,'',TSctReadOnlySubProperty);
  RegisterPropertyEditor(TypeInfo(TSctLevel),TSctBand,'',TSctReadOnlySubProperty);
{  RegisterPropertyEditor(TypeInfo(TSctBand),TSctReserveSpace,'',TSctReserveBandProperty);}
{$ifdef AceBDE}
  RegisterPropertyEditor(TypeInfo(TDataSource),TSctDataSourceGuide,'',TSctDataSourceDSGProperty);
{$endif}



{
  sctexpert := TSctExpert.Create;
  RegisterLibraryExpert(sctexpert);}

  RegisterComponents('AceReporter', [TAceMeter]);
  RegisterComponents('AceReporter', [TAcePreview]);

end;

end.

⌨️ 快捷键说明

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