Set Child band invisible

edited 7:01PM in FastReport 4.0
Why does this code from within Delphi does not set the FR child band invisible?
frxReport1.FindObject('Child1').Visible := false

Comments

  • gpigpi
    edited 7:01PM
    This code should work. Check your code and script
  • edited 7:01PM
    I figured out that is DOES work when standing alone.
    In order not to show a blank child band if the only contained field is empty though, I use this code in OnBeforePrint:
    wrote:
    if <frxDBqPacklist."Comment"> = '' then
    Child1.visible := false
    else
    Child1.visible := true

    This of renders the setting in Delphi obsolete, of course.

    Is there a simple way not to show a empty child band?
    Or how could I tell FR that the above code should only be executed if child1 shall be displayed at all?
    (It is an optional information that the user chooses to display or not display before print)
  • gpigpi
    edited 7:01PM
    wrote:
    Or how could I tell FR that the above code should only be executed if child1 shall be displayed at all?
    (It is an optional information that the user chooses to display or not display before print)
    Use in the Delphi:
    frxReport1.Script.Variables['HideChild'] := False;
    
    in the script:
    if (<frxDBqPacklist."Comment"> = '') or (HideChild) then
    Child1.visible := false
    else
    Child1.visible := true
    
  • edited June 2017
    ... thanks gpi.

    When I put:
    wrote:
    var
    HideChild1: TfrxVariable;

    in Delphi, I get an "undefinied identifier" error.

    Do I need to add a library to uses?

    It seems as if i don't declare HideChild1 variable I get an undefined identifer in FR.

    Also, adding Hidechild1 variable in FR does not help (screenshot).
    ?
  • gpigpi
    edited 7:01PM
    frxReport1.Script.Variables['HideChild'] := False;
    
    Add script (not report) variable. Use my code only
  • edited June 2017
  • gpigpi
    edited 7:01PM
    wrote:
    how should FR know about a variable that is defined in Delphi?
    This script will be works in the run-time only.
    If you want - you may use report variable instead of script variable

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.