[ Home | Contents | Search | Next | Previous | Up ]
Date: 12/1/99
Time: 10:41:46 PM
I have a sample MDI application program that will allow me to open/create a new text file(s). I'd like to be able to print these files but when I tried to run (execute 'Print' menu item), it crashed. Would anyone tell me what I've done wrong here. Any pointer is appreciated. Here is what I have :
class TMyApp : public TApplication {
public:
...
TPrinter* Printer;
TMDIClient* MdiClient;
void CmFilePrint();
virtual void InitMainWindow;
DECLARE_RESPONSE_TABLE(TMyApp);
}
=====
DEFINE_RESPONSE_TABLE(TMyApp,TApplication)
EV_COMMAND(CM_FILEPRINT,CmFilePrint),
...
END_RESPONSE_TABLE;
//
void TMyApp::InitMainWindow()
{
...
MdiClient = new TMDIClient;
TDecoratedMDIFrame* frame = new TDecoratedMDIFrame(Name, IDM_MDI, *MdiClient,
false);
...
}
void TMyApp::CmFilePrint()
{
if( !Printer)
Printer = new TPrinter;
TPrintout printout("Printer Output...");
Printer->Print(this,printout,true);
}
TPrintOut is an abstract base class.
You need to derive your own class from TPrintOut and
at least override the PrintPage() method.
Check out the help and the printing example
in \Examples\Owl\Classes\Printing\printing.ide