Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » CExtTreeGridWnd print & print preview not available problem Collapse All
Subject Author Date
Wang Hui Qing Jul 10, 2008 - 2:00 AM

Hi Tech Support,


 I’m new user to your product and now trying to build a demo to get self familiar with your product. I get CChildView class inherited from CextGridWnd in a MDI Doc/View like:


class CSampleWorkspace01View : public CExtPPVW <CExtTreeGridWnd>


 And I try to follow the sample code of SimpleGrids and find the print & print preview button/menu item are always greyed. As I can see from SimpleGrids code there is actually nothing specially to be done to get print/print preview work except inherit from CExtPPVW temple class. Anything else I’m missing?


 Btw: I also find the document not so detailed, to just give example: CExtPPVW and OnGetPrintableDocTitle() are used in the sample code, but there is nowhere in documents you can find any reference..

Wang Hui Qing Jul 11, 2008 - 1:08 AM

Dear Tech Support,


I follow your advice, however, print/print review still not work (icon/menu greyed). Following is the code snippet of CChildFrame and CView class, please take a look and help if anything wrong, thanks


class CChildFrame : public CExtNCW < CMDIChildWnd >

{


...


}


BOOL CChildFrame::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo)

{

    CMainFrame *pFrame =

             (CMainFrame*)AfxGetApp()->m_pMainWnd;



    // Get the active MDI child window.

    CChildFrame *pChild =

                 (CChildFrame *) pFrame->GetActiveFrame();



    // or CMDIChildWnd *pChild = pFrame->MDIGetActive();



    // Get the active view attached to the active MDI child

    // window.

    CSART_SampleWorkspace01View *pView = (CSART_SampleWorkspace01View *) pChild->GetActiveView();



    if( pView != NULL )

    {

        if( pView->OnCmdMsg(nID, nCode, pExtra, pHandlerInfo) )

            return TRUE;

    }

    return CExtNCW < CMDIChildWnd >:: OnCmdMsg( nID, nCode, pExtra, pHandlerInfo );

}


class CSART_SampleWorkspace01View : public CExtPPVW <CExtTreeGridWnd>

{

...


}


BOOL CSART_SampleWorkspace01View::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo)

{

    return CExtPPVW < CExtTreeGridWnd > :: OnCmdMsg( nID,nCode,pExtra,pHandlerInfo );

}

Technical Support Jul 12, 2008 - 9:26 AM

The CChildFrame::OnCmdMsg() method contains a lot of code but does nothing because the main frame’s OnCmdMsg() method automatically invokes OnCmdMsg() method of active MDI child frame. The last method invokes OnCmdMsg() method of view window inside MDI child frame. So, the CChildFrame::OnCmdMsg() method can be simply removed. Please compare all the OnCmdMsg() and PreTranslateMessage() virtual methods in your project with the same methods in the DrawCli sample application where printing/previewing works OK.

Wang Hui Qing Jul 13, 2008 - 7:29 PM

Dear Tech Support,


I check DrawCli and follow those codes in OnCmdMsg() and PreTranslateMessage(), but still yet to get printing/previewing works... The difference between my program and DrawCli lies in that the CView class in mine inherit from CExtTreeGridWnd. In my program seems ID_FILE_PRINT/ID_FILE_PRINT_PREVIEW cannot be automatically captured and handled by CExtPPVW. Change to another way, can you tell me which methods in CExtPPVW can I call explicitly to handle print/preview msg? Thanks.

Technical Support Jul 14, 2008 - 8:21 AM

The CExtPPVW < CExtTreeGridWnd > :: OnCmdMsg() method handles and updates all the ID_FILE_PRINT_***** commands. If the OnCmdMsg() virtual method of your tree grid view is invoked and there are no problems with command routing in your project, then all the printing commands should be invoked correctly.

Please note: some changes in C++ source code require complete rebuilding of your Visual C++ project. For instance, if you have compiled your project at least once and then changed default parameter value in some parameter of some function or method, then you need complete rebuild to make code generator using new default parameter value. This is well known issue which is related to any Visual C++ version including good old Visual C++ 6.0. There are several similar issues related to changing base class type and especially template based class types.

Wang Hui Qing Jul 14, 2008 - 7:41 PM

still no luck...


I’ve sent you the source code of my project, please kindly take a look at it. Thanks.

Technical Support Jul 18, 2008 - 1:14 PM

We have answered your e-mail and described you detailed step-by-step instructions of how to fix all the issues in your project. We are sorry for the delay. We are very overloaded with e-mail support.

Technical Support Jul 10, 2008 - 12:49 PM

The CExtPPVW template class implements the OnCmdMsg() virtual method which handles and updates the standard ID_FILE_PRINT_***** commands. That is why they work automatically in most cases. The only thing you may need is to invoke the OnCmdMsg() method of your tree grid window from the OnCmdMsg() method of some other window in your application. I.e. you should implement command routing for your tree grid window in your project. If your tree grid window is the main view window in SDI project, then the main frame window should do command routing to your tree grid window. If your tree grid window is the view window inside MDI child frame window in MDI project, then the MDI child frame window should do command routing to your tree grid window. If your tree grid window has any other special location in any type of project (if it’s child of control bar, child of some dialog etc.) then you also should implement appropriate command routing invocations.

The CExtPPVW template class was designed for providing printing/previewing APIs similar to same APIs MFC view windows (CView and derived from it). The documentation for the CExtPPVW template class is unfortunately incomplete because we are still not finished development of printing/previewing subsystem.

Wang Hui Qing Jul 16, 2008 - 7:28 PM

Dear Tech Support,


 


It’s been two days since I sent you the email for the above issue, no response? Really appreciate you can take a look at it. Thanks.

Technical Support Jul 18, 2008 - 1:14 PM

We have answered your e-mail and described you detailed step-by-step instructions of how to fix all the issues in your project. We are sorry for the delay. We are very overloaded with e-mail support.