On PageFooter1OnBeforePrint execute Engine.ShowBand(Child1) program terminate

Sorry, my English not well.

On Page1 Add MasterDataBand, PageFooterBand and ChildBand

MasterData link to BDETable
var
  PageLine: integer;
  PageMaxLine: integer = 15;
  
procedure PageFooter1OnBeforePrint(Sender: TfrxComponent);
var      
  i: integer;
begin
  i := iif(PageLine=0,PageMaxLine,PageLine);                                         
  while i < PageMaxLine do
  begin
    inc(i);  
    Engine.ShowBand(Child1);      
  end;
end;

procedure MasterData1OnBeforePrint(Sender: TfrxComponent);
begin
  PageLine := <LINE> mod PageMaxLine;
  if (PageLine = 1) and (<LINE> > 1) then
  begin
    Engine.NewPage;                                                
  end;            
end;

when program run to Engine.ShowBand(Child1); then program terminate.

Comments

  • gordkgordk St.Catherines On. Canada.
    edited 4:40AM
    Be careful as to which event of which object you write your code in.
    also keep in mind that it is sometimes usefull to have a header/footerband of zero height so that you have the events of these bands available for processing code to make other things happen before reaching the page footer.
    for example filling remainig space on page with a unattached child band after the recordset is finished.
    in the oap event of the databandfooter
    retreive the engine.freespace divide it by the height of the child band and in a fornext loop show the child.

    if int(engine.freespace/child1.height) > 0 then
    begin
    for i = 1 to int(engine.freespace/child1.height) do
    begin
    engine.showband(child1);
    end;
    end;
  • edited 4:40AM
    gordk wrote: »
    Be careful as to which event of which object you write your code in.
    also keep in mind that it is sometimes usefull to have a header/footerband of zero height so that you have the events of these bands available for processing code to make other things happen before reaching the page footer.
    for example filling remainig space on page with a unattached child band after the recordset is finished.
    in the oap event of the databandfooter
    retreive the engine.freespace divide it by the height of the child band and in a fornext loop show the child.

    if int(engine.freespace/child1.height) > 0 then
    begin
    for i = 1 to int(engine.freespace/child1.height) do
    begin
    engine.showband(child1);
    end;
    end;

    Thank you for telling me.

    i clear my write code

    add one footer

    set footer hieght = 0

    add code listed below:
    procedure Footer1OnBeforePrint(Sender: TfrxComponent);
    var i:integer;                                  
    begin
      if int(engine.freespace/child1.height) > 0 then
      begin
        for i := 1 to int(engine.freespace/child1.height) do
        begin
          engine.showband(child1);                       
        end;              
      end;            
    end;
    

    now working well.

Leave a Comment