Hide/show logo

edited 4:00PM in FastReport 4.0
Hi!

Could anyone help me on this one, please?
I need to make it possible for the users in the place I work, to have an option to show or hide the company logo/letterhead before they print a report... (So if they print om our preprinted stationary - they won't get the letterhead twice).
Been searching this forum, but haven't really found the answer.
Is that at all possible?

I'm quite new to Fast-Report and have basically no experience in delphi-programming, so an example-page would be very appreciated :-)

Hope someone have a sollution.

Thanx in advance.

/Christian

Comments

  • edited July 2009
    Hi...

    I do it as follows:

    you need a Title Band and a Picture on it.

    the RadioButtons in your Options before the print:
    RadioButton1- print with Picture
    RadioButton2- reserve the Place for an Picture what is placed on the Paper
    Radiobutton3- print without a Picture

    LogoPath- the Path to your Picture
    procedure TFPrint.Title;
    var
      HeaderPicture: TfrxPictureView;
      Titel: TfrxReportTitle;
    begin
      if RadioButton1.Checked then
        begin
          if FileExists(LogoPath) then
            begin
              HeaderPicture:=TfrxPictureView(frReport1.FindObject('Picture1'));
              HeaderPicture.Picture.LoadFromFile(LogoPath);
    
              Titel:=TfrxReportTitle(frReport1.FindObject('ReportTitel1'));
              Titel.Visible:= True;
              HeaderPicture.Width:= HeaderPicture.Picture.Width;
              HeaderPicture.Height:= HeaderPicture.Picture.Height;
              Titel.Height:= HeaderPicture.Picture.Height + 20;
              HeaderPicture.Top:= 10;
            end
              else
                begin
                  Titel:=TfrxReportTitle(frReport1.FindObject('ReportTitel1'));
                  Titel.Visible:= False;
                end;
        end;
      if RadioButton2.Checked then
        begin
          Titel:=TfrxReportTitle(frReport1.FindObject('ReportTitel1'));
          Titel.Visible:= True;
          Titel.Height:= 300;  // the High you want to reserve
        end;
      if RadioButton3.Checked then
        begin
          Titel:=TfrxReportTitle(frReport1.FindObject('ReportTitel1'));
          Titel.Visible:= False;
        end;
    end;
    

    it??s an example. you must change it for you.

    i hope it??s help >
  • edited 4:00PM
    Thanks for your effort :-)

    I can't get this to work though...
    When I try to preview my report, I get an error in the code (';' expected):
    procedure TFPrint.Title;
    (It wants me to place ';' just after TFPrint - before .)

    What can I do about that?
  • gordkgordk St.Catherines On. Canada.
    edited 4:00PM
    the easiest method is to decide what to do before you call show report.
    you can set a variable hidelogo from either delphi or from a report dialog.
    in the report script write code in the obp event of the pictureview object.
    visible := not hidelogo;
  • edited July 2009
    Hi,

    I dont know how. I copy this code from my project. I have only change the Names from german to english. Sometimes the name "Title" is a reserved word. Change to an different. I wrote "Titel" its??s the german Title.
    Do you declare the procedure in public or private ?

    bye
  • gordkgordk St.Catherines On. Canada.
    edited 4:00PM
    not sure what you do not understand?
    you will use a tfrxpictureview object to display the logo
    the 2 important properties of this object in your case is visible or printable.
    you can control either using a value in a variable.
    a variable value can be set from delphi.
    ie afterloading and before calling show or print.
    frxreport1.loadfromfile('pathe&filename.fr3');
    frxreport1.variables := true;
    or you can
    create a dialog form in the report and set the value of the variable there.
    typical use would be in the obp event of the band containing the pictureview object
    or in the obp event of the picture view.
    pictureview1.printable := <myvarname>;
    or you can work from delphi through the obp event of the tfrxreport component to check what object is being handled and if pictureview1 then set its prop according to a delphi variable.
    many different ways to work depends upon what suits you best.
  • edited July 2009
    Thanks for your help guys...

    I'll try my way today... Hope it works for me ;-)
  • edited 4:00PM
    Help! I don't get this... (as mentioned I'm all new to Fast-report and to coding in pascal/delphi).

    My goal is to create a Dialogue Page, where my users can choose to print or no-print a picture.

    I've made to radio buttons - one for printing with picure. One for printing without picture.
    And then I'm lost... I don't know what variable to use (and basically don't know what a variable is... sorry)

    Would you be so kind to give the code to copy/paste? [img]style_emoticons/<#EMO_DIR#>/rolleyes.gif" style="vertical-align:middle" emoid=":rolleyes:" border="0" alt="rolleyes.gif" /> This is all I have right now - and that's not much, I know :-) :[/img]
    wrote:
    procedure RadioButton1OnClick(Sender: TrfxComponent);
    begin

    end;

    procedure RadioButton2OnClick(Sender: TfrxComponent);
    begin

    end;
  • gordkgordk St.Catherines On. Canada.
    edited 4:00PM
    we really aren't here to teach you how to code in delphi or script.
    you don't need 2 radio buttons to make a choices you only need 1

    here is a sample.
    assuming you knew enough to add 2 buttons and set their modal result props.

    use a checkbox.
    leave it's state as cbunchecked.
    checkbox1 caption 'print using plain paper'

    in the obp event of the band containing the pictureview object for your logo,
    write code to set the printable property of the pictureview object.
    ie
    pictureview1.Printable := checkbox1.checked;

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.