Label Wizard
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.
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.
This discussion has been closed.
Comments
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
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.
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
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
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