CView::OnFilePrint() from Print Preview
Mats Mеnhav -- manhav@connectum.skurup.se Saturday, October 05, 1996 -- [ From: Mats Manhav * EMC.Ver #2.5.02 ] -- Environment: MSVC 4.2 Win 95/NT 4.0 Hi, In my application I have a view that handle the ID_FILE_PRINT (OnFilePrint() ) command itself. The view is a CFormView derived class, and the reason I am doing this is to let the user choose from a dialog box what he would like to print. In the dialog box the user selects the items he wants to print and clicks on either "Print" or "Print Preview". When the user selects "Print" or "Print Preview" I set some variables in the class that tells what is supposed to be printed and call CView::OnFilePrint or CView::OnFilePrintPreview(). Thus the Framework will handle the print loop for me. My problem arises if the user selects "Print" in the Print Preview toolbar. The CPreviewView class will then end the Preview mode and send the command ID_FILE_PRINT to the main window. When this arrives to the application it will direct the command to my view and my dialog box for selecting items to be printed will show up again. But the user had already selected what to print. What I really would like is that the print loop to be started immediately when exiting the preview mode (i.e the CView::OnFilePrint() should be called instead of CMyView::OnFilePrint() ) Does anyone has a suggestion on how to solve this? I can see one ugly solution to this, which I would not like to use, and that is copying the Preview source into my own project and modify it to suit my needs. If at all possible I DO NOT WANT TO DO THAT ! Mats -- ========================================================================== Mats Mеnhav (Mats Manhav for 7-bit people) email:manhav@connectum.skurup.se WWW: http://connectum.skurup.se/~manhav FAX: (int) 46 (0) 414 243 05 Phone: (int) 46 (0) 414 243 05 ==========================================================================
Lee Thompson -- lee@usa.nai.net Sunday, October 06, 1996 Hi, Could you change the ID of your menu print item, and if applicable toolbar button, to something like ID_MY_FILE_PRINT, then when handling that message use your dialog to choose what to print? Then you could put back the default implementation of OnFilePrint, so that when CPreviewView sends ID_FILE_PRINT it will just print. Lee Thompson CFancySignoff.CreateRandom();
| Вернуться в корень Архива |