Home End User
New Blog Posts: Merging Reports - Part 1 and Part 2

Label Wizard

edited November 2005 in End User
I am creating a barcode program and would like to use the label wizard so
that the user can use different label sizes. In my program the label wizard
will pop up and the user can select a label but then i get an access
violation after they hit ok because the label wizard is not linking to the
ppReport. I have a ppReport on the form and i want to use that so that i
can use a before print to change barcode types. any suggestions. thanks.

Comments

  • edited November 2005

    Here is an downloadable example that shows how to use the Label Wizard
    outside of the context of the Report Designer

    www.digital-metaphors.com/tips/LaunchLabelWizardInCode.zip




    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited November 2005
    Ok I got the program to print out my barcodes onto the avery labels. My next
    question is how can i do a before print with this code. i have used the
    before print when the report is on the form but not when it is created
    programmatically. I need to change the type of the barcodes between each
    detail band. thanks.




  • edited November 2005

    You can assign Delphi event-handlers programmatically


    1. Add the event-handler method to your form class

    procedure TForm1.myDetailBeforePrint(Sender: TObject);
    begin

    end;

    2. Create the report and then assign the event-handler

    myReport.DetailBand.BeforePrint := myDetailBeforePrintHandler;







    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited November 2005
    Ok i did what you said,

    i added a procedure called MyDetailBeforePrint(Sender: TObject) and added
    the code that i wanted the before print to do. When i call the
    createReportEvent, i create the report and then set the datapipeline and
    then set FReport.DetailBand.BeforePrint := MyDetailBeforePrintHandler; and
    then when i try to compile it, it says that MyDetailBeforePrintHandler is an
    undeclared identifier.

    thanks


  • edited November 2005

    The event-handler method needs a to be a method of the same class in which
    you are creating the report.

    TmyForm = class(TForm)
    private
    FReport: TppReport;

    procedure MyDetailBeforePrint(Sender: TObject) ;
    procedure CreateReport;

    end;

    procedure TmyForm.CreateReport;
    begin
    FReport := TppReport.Create(Self);
    FReport.CreateDefaultBands;
    Report.DetailBand.BeforePrint := MyDetailBeforePrint;

    end;





    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
This discussion has been closed.