Recent

Author Topic: Lazarus 1.2.2 + LazReport , Custom Collor data row's (unexpected side effect)  (Read 3472 times)

robert83a1

  • New Member
  • *
  • Posts: 25
Hi all,

 My report has two master data records so I set it up like this :
Code: [Select]
MASTER HEADER
-------------------------------------------
column names
-------------------------------------------
MASTER DATA
-------------------------------------------
data for the columns
-------------------------------------------
MASTER HEADER
-------------------------------------------
Column names
-------------------------------------------
MASTER DATA
-------------------------------------------
data for the columns
-------------------------------------------

Everything is fine, data is always displayed correctly...I've modified the frDBDataSet1 and frDBDataSet2 like this

Code: [Select]
procedure TCityStat.frDBDataSet1First(Sender: TObject);
begin
  Row:=0;
end;
procedure TCityStat.frDBDataSet1Next(Sender: TObject);
begin
  inc(Row);
end;

procedure TCityStat.frDBDataSet2First(Sender: TObject);
begin
  Row:=0;
end;

procedure TCityStat.frDBDataSet2Next(Sender: TObject);
begin
  inc(Row);
end;   

And finally on report itself I did this :
Code: [Select]
rocedure TCityStat.frReport1EnterRect(Memo: TStringList; View: TfrView);
begin
  view.FillColor := clWhite;
  if Row mod 2 = 0 then
    view.FillColor := $00BBBBBB;
end;

Now this is doing exactly what I told him to do :) , it colors every other row with lightgrayish color. The main problem is I want to leave the MASTER HEADER
color as is (WHITE) , is there a way to somehow know when I'm at MASTER HEADER part of the report it should be always white?

Right now my MASTER HEADER is grayish , then the first data line white, then grey, then white, then gray...etc...

Greetings
Robert



taazz

  • Hero Member
  • *****
  • Posts: 5368
check the view.name or view.tag or what ever you want, to be a view in the data bands and not the other bands.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

robert83a1

  • New Member
  • *
  • Posts: 25
Thank you I've just tried to do it

part of my lazreport file :
Code: [Select]
        <Object3>
          <Name Value="MasterData1"/>
          <ClassName Value="TfrBandView"/>
          <Visible Value="True"/>
          <Typ Value="gtBand"/>
          <StreamMode Value="0"/>
          <Size>
            <Left Value="0"/>
            <Top Value="384"/>
            <Width Value="753"/>
            <Height Value="18"/>
          </Size>
          <Flags Value="48"/>
          <Data>
            <Script Value=""/>
          </Data>
          <Tag Value=""/>
          <FURLInfo Value=""/>
          <BandType Value="btMasterData"/>
          <Condition Value=""/>
          <DatasetStr Value="frDBDataSet2"/>
        </Object3>

altered Report1 enter rect :
Code: [Select]
procedure TCityStat.frReport1EnterRect(Memo: TStringList; View: TfrView);
begin
  view.FillColor := clWhite;
  if View.Name='MasterData1' then
      begin
        if Row mod 2 = 0 then
          view.FillColor := $00BBBBBB;
      end;
end;

I've tried view.Name and view.Tag nothing happens, everything is white...it's like the name is something else...

Greetings
Robert

taazz

  • Hero Member
  • *****
  • Posts: 5368
Code: [Select]
procedure TCityStat.frReport1EnterRect(Memo: TStringList; View: TfrView);
begin
  view.FillColor := clWhite;
  if view.Parent.Typ = btMasterData; then
      begin
        if Row mod 2 = 0 then
          view.FillColor := $00BBBBBB;
      end;
end;
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

robert83a1

  • New Member
  • *
  • Posts: 25
Thank you

VERY-VERY-VERY much!!!!!!!!!!! It works yipppeeeeee


Have a nice day

Greetings
Robert

 

TinyPortal © 2005-2018