|
|
|
|
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.
Subject |
Author |
Date |
|
Michele Cillo
|
Nov 1, 2007 - 5:51 PM
|
Hi all. I’m using print preview functionality from CExtPPVW template class for display database report directly in print preview mode. All works fine, but i need add some button to to CExtPPVW_ToolBar embedded in CExtPPVW_HostWnd for manage other operation, such as export in some format, reload report, ecc. How can I add other buttons to toolbar and how I manage events fired from this new buttons? Thanks in advace.
|
|
Michele Cillo
|
Nov 3, 2007 - 8:50 AM
|
I found a solution myself. I created CMyExtPPVW_HostWnd : public CExtPPVW_HostWnd and in this I added new message map entries with ON_COMMAND and ON_UPDATE_COMMAND_UI macros. Then, in command handlers, I forwarded my button’s message to my CExtPPVW < CScrollView > using m_pPpvPrintable pointer.
In CExtPPVW < CScrollView > I overrided OnCmdMsg and added this snippet:
switch( nCode ) { case CN_COMMAND: switch( nID ) { ... case ID_FILE_PRINT_PREVIEW: CExtPaintManager::stat_PassPaintMessages(); if( m_bPrintPreviewEnabled && IsPrinterAvailable() ) { if( m_bPrintPreviewCheckMarkCmdStyle && m_pWndPP->GetSafeHwnd() != NULL ) m_pWndPP->OnPreviewClose(); else CExtPPVW_Printable::DoPrintPreview( true, false, RUNTIME_CLASS(CMyExtPPVW_HostWnd) ); } return TRUE; ... } break; }
for using my CExtPPVW_HostWnd derived class.
So, with others little adjustment, now all work fine. In any case, thanks for yuor interest.
|
|
Michele Cillo
|
Nov 2, 2007 - 3:30 PM
|
Thanks for response, but I have some problem for implementing it. I’m using CExtPPVW < CScrollView > and I overrided CExtPPVW_Printable::OnInitializePrintPreviewToolBar() function and added my buttons in toolbar. My buttons, of course, are disabled. Now, I want to handle CN_COMMAND and CN_UPDATE_COMMAND_UI in my class, ma my buttons doesn’t send WM_COMMAND to my CExtPPVW < CScrollView >. I experimented with OnCmdMsg and with ON_UPDATE_COMMAND_UI and ON_COMMAND macro, but noone works. What is the simpler solution to this message routing problem?
|
|
Technical Support
|
Nov 2, 2007 - 9:19 AM
|
Thank you for the interesting question. You should override the CExtPPVW_Printable::OnInitializePrintPreviewToolBar() virtual method in a CExtPPVW < CExtGridWnd > - derived class (or in a CExtPPVW < CExtTreeGridWnd > - derived class, or yet in a CExtPPVW < CExtReportGridWnd > - derived class). Your method should invoke the parent class method and then modify content of the CExtPPVW_Printable::m_pWndPP->m_pPpvWndToolBar toolbar. You can also implement the CExtPPVW_Printable::OnInitializePrintPreviewToolBar() toolbar from scratch using source code of original method. Your custom commands in this toolbar should be handled/updated in your CExtPPVW < CExtGridWnd > - derived class.
|
|