Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Report Control
  New Posts New Posts RSS Feed - [SOLVED] CXTPReportView trapped ID_FILE_PRINT
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Topic Closed[SOLVED] CXTPReportView trapped ID_FILE_PRINT

 Post Reply Post Reply
Author
Message
Pat@Yahoo View Drop Down
Newbie
Newbie
Avatar

Joined: 13 September 2010
Status: Offline
Points: 2
Direct Link To This Post Topic: [SOLVED] CXTPReportView trapped ID_FILE_PRINT
    Posted: 14 September 2010 at 7:31am
Hi all,

I have a MDI application which one of the view is a derived class of CXTPReportView.
My application have a (ID_FILE_PRINT) print button on the toolbar which is handled
by the application (not the view) to print formatted reports.

My problem is that if a record item is selected in the CXTPReportView (control), the ID_FILE_PRINT
is sent to the report view/control and my print function is not called (the default print
is called from the class CXTPReportView).

How can I make my CXTPReportView derived class not be called when the ID_FILE_PRINT
button is pressed?

I've tried to reflect the control command (ID_FILE_PRINT) but still have the same behavior
(I'm still receiving the the command message).

I need some help ...
Thanks,
PA


Back to Top
Pat@Yahoo View Drop Down
Newbie
Newbie
Avatar

Joined: 13 September 2010
Status: Offline
Points: 2
Direct Link To This Post Posted: 14 September 2010 at 8:43am
Well ... after some investigation, I found my problem.

I overload the function OnCmdMsg and return false in the case where the nCode = 0 and other parameters to NULL ... here the code :

BOOL CViewReportTestsAndCalibrations::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo)
{
   if (nID == ID_FILE_PRINT)
   {
      // Print message has been sent ... do not process the command ...
      // let the system routes it to the frame/doc object
      if ( nCode == 0 && pExtra == NULL && pHandlerInfo == NULL )
      {
         return FALSE;
      }

      // Otherwise return true to activate the ID_FILE_PRINT button ... (patch)
      return TRUE;
   }

   return CXTPReportView::OnCmdMsg(nID, nCode, pExtra, pHandlerInfo);
}

Regards ...
PA
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.141 seconds.