Print Page | Close Window

[SOLVED] CXTPReportView trapped ID_FILE_PRINT

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Report Control
Forum Description: Topics Related to Codejock Report Control
URL: http://forum.codejock.com/forum_posts.asp?TID=17241
Printed Date: 29 September 2024 at 7:25am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: [SOLVED] CXTPReportView trapped ID_FILE_PRINT
Posted By: Pat@Yahoo
Subject: [SOLVED] CXTPReportView trapped ID_FILE_PRINT
Date 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





Replies:
Posted By: Pat@Yahoo
Date 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



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net