Download
You can download the source-code of the demo application here:
(Windows, VC++) or
(SuSE Linux 9.0).
(The above pictures were taken from the Windows version.)
The source-codes of the ReportWriter are here:
(Windows, VC++) or
(SuSE Linux 9.0).
Usage under Windows
Since I don't have write access to the wxWidgets CVS,
I've put the source-files from the archive into my local
wxWidgets source tree (.../src/common/repwrt.cpp and
.../include/wx/repwrt.h) and added repwrt.cpp to my local wxWidgets.dsp
Visual C++ project. After that, wxWidgets library needs to be re-compiled.
Usage under Linux
Please read
README-wxRepWrt.txt
which you'll find in your WXWIDGETS directory
after you have un-tarred the source-codes.
Hints for preview and/or printing
wxRepWrt contains a class called wxReportSelector
which lets you interactively select a stored report for preview
and/or printing. Since the
wxReportWriter
has to open the report-file on disk, there is a risk
that the file stays open after preview or printing if you use
the sequence of functions in the wrong order.
Here is some code which should be used in an application:
void MyFrame::OnSelectAReport( wxCommandEvent &event )
{
wxReportSelector dlg( this,
wxT("Existing Reports"), // title
wxT(".") ); // path to reports
if ( wxID_OK == dlg.ShowModal() )
{
wxReportWriter *pReport;
switch ( dlg.GetSelected() )
{
default:
break;
case REPSEL_PRINT:
case REPSEL_PREVIEW:
pReport = new wxReportWriter( // This opens the report-file
this,
dlg.GetFilename(),
wxPoint(10,10),
wxSize( 100, 100 ) );
pReport->SetupReport( dlg.GetFilename() );
if ( dlg.GetSelected() == REPSEL_PRINT )
{
pReport->Print();
pReport->FinishReport(); // closing the report-file
}
else
pReport->PrintPreview(); // this function will close
// the report-file auto-
// matically in its
// OnCloseWindow() function
break;
} // switch
} // if wxID_OK...
} // end of OnSelectAReport()
June 2004 ---
Juergen D. Geltinger
jgelti(at)ifd.de
Last change: 14-Jun-2004
© Copyright 2002-2004, IFD Altdorf, Germany
All rights reserved
|