about frxComponent access by index or similar
Hello:
I need optimized my code into the frx file, not in delhi code, so in this moment to developer use this code, i repeat in the code into frx file:
so I wil prefer something so:
but the reporter show error, so i think that this is because I do not how reference to frxComponet, in this case frxMem, for it index
Exists another metoht fot this correct???
thanks
I need optimized my code into the frx file, not in delhi code, so in this moment to developer use this code, i repeat in the code into frx file:
procedure MasterData1OnBeforePrint(Sender: TfrxComponent);
begin
  If( ( DayOfWeek( StrToDate(<Date01>) ) = 1) or
      ( DayOfWeek( StrToDate(<Date01>) ) = 7) ) then
  begin
      Memo11.Color := clRed;
      Memo42.Color := clRed;
      Memo73.Color := clRed;         Â
  end
  else
  begin
      Memo11.Color := clWhite;
      Memo42.Color := clWhite;
      Memo73.Color := clWhite;         Â
  end;
  If( ( DayOfWeek( StrToDate(<Date02>) ) = 1) or
      ( DayOfWeek( StrToDate(<Date02>) ) = 7) ) then
  begin
      Memo12.Color := clRed;
      Memo43.Color := clRed;
      Memo74.Color := clRed;         Â
  end
  else
  begin
      Memo12.Color := clWhite;
      Memo43.Color := clWhite;
      Memo74.Color := clWhite;         Â
  end;
  If( ( DayOfWeek( StrToDate(<Date03>) ) = 1) or
      ( DayOfWeek( StrToDate(<Date03>) ) = 7) ) then
  begin
      Memo13.Color := clRed;
      Memo44.Color := clRed;
      Memo75.Color := clRed;         Â
  end
  else
  begin
      Memo13.Color := clWhite;
      Memo44.Color := clWhite;
      Memo75.Color := clWhite;         Â
  end;
.....
...
..
  If( ( DayOfWeek( StrToDate(<Date31>) ) = 1) or
      ( DayOfWeek( StrToDate(<Date31>) ) = 7) ) then
  begin
      Memo42.Color := clRed;
      Memo73.Color := clRed;
      Memo104.Color := clRed;         Â
  end
  else
  begin
      Memo42.Color := clWhite;
      Memo73.Color := clWhite;
      Memo104.Color := clWhite;         Â
  end;
end;
so I wil prefer something so:
procedure MasterData1OnBeforePrint(Sender: TfrxComponent);
var i:Integer
begin
  for i := 1 to 31 do
  begin
      If( ( DayOfWeek( StrToDate(frxComponent.index[i]) ) = 1) or
      ( DayOfWeek( StrToDate(frxComponent.index[i]) ) = 7) ) then
      begin
      frxComponent.index[i+31].Color := clRed;
      frxComponent.index[i+62].Color := clRed;
      frxComponent.index[i+93].Color := clRed;
      end
      else
      begin
      frxComponent.index[i+31].Color := clWhite;
      frxComponent.index[i+62].Color := clWhite;
      frxComponent.index[i+93].Color := clWhite;
      end;
  end;
end;
but the reporter show error, so i think that this is because I do not how reference to frxComponet, in this case frxMem, for it index
Exists another metoht fot this correct???
thanks
Comments
var
i: Integer;
c: TObject;
for i := 0 to Sender.Objects.Count - 1 do
begin
c := Sender.Objects
if c is TfrxMemoView then
TfrxMemoView©.Visible := False// or whatever prop you want to set
else if c is TfrxLineView then
TfrxLineView©.Visible := True
end;