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 2:17AM
    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 2:17AM
    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

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.