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 |
|
Torsten Schucht
|
Oct 24, 2007 - 3:53 AM
|
I want to disable or enable a command in the command manger. I do this by e.g. ... CExtCmdItem* pCmdItem; CString sProfile = g_CmdManager->ProfileNameFromWnd( this->GetSafeHwnd()); pCmdItem = g_CmdManager->CmdGetPtr(sProfile, ID_PROJECT_NEW); pCmdItem->StateEnable(false); ... Now I would like to have the entries in the menu bar which correspond to the commands to be enabled/disabled as well when the user opens the menu.
What I am doing right now is to ’walk’ through the menu items in CMainFrame::OnExtMenuPrepare, check the state of the command and enable/disable the coressponding popup item (see below). .... INT nEntries = pPopup->ItemGetCount(); CExtCmdItem* pCmdItem; CString sProfile = g_CmdManager->ProfileNameFromWnd( this->GetSafeHwnd()); for (INT i = 0; i < nEntries; i++) { UINT nCmdID = pPopup->ItemGetCmdID(i); if (nCmdID != CExtPopupMenuWnd::TYPE_POPUP && nCmdID != CExtPopupMenuWnd::TYPE_SEPARATOR) { pCmdItem = g_CmdManager->CmdGetPtr(sProfile, nCmdID); ASSERT (pCmdItem != NULL); if (pCmdItem) { pPopup->ItemEnabledSet(i, pCmdItem->StateIsEnable()); } } } ... This worked fine until I added the CExtThemeSwitcherToolControlBar to my CMainFrame. Now I get a NULL pointer for pCmdItem when I reach the first entry of the CExtThemeSwitcherToolControlBar menu. When it comes to the next entry the call to pPopup->ItemGetCmdID(i); fails with an illegal memory access exception.
At this point I think, that I do not understand the CommandManager correctly. Could you please clarify this and tell me how to make the enabling/disabling of commands and menu entries in the way it is meant to be done?
Thanks. Torsten
|
|
Torsten Schucht
|
Oct 26, 2007 - 2:36 PM
|
OK, I think I got it know. I thought that the Command Manger would do this for me as he does it with e.g. the icons of the commands. Thanks for your help.
|
|
Torsten Schucht
|
Oct 25, 2007 - 2:42 PM
|
Ok, thats the way I would do it for the theme switcher, but how is this done for the standard menu?
I thought that the command manager would handle the enable/disable state of the commands and also causes the display of the commands (in a menu or toolbar) to be accordingly enabled/disabled. Or is is the command manager just a container which maps id’s to icons, text, state, etc. ?
|
|
Suhai Gyorgy
|
Oct 26, 2007 - 1:43 AM
|
I think you should do this as you’d do it in a pure MFC application: using ON_UPDATE_COMMAND_UI entries and associated state updating methods for your commands. This would set the proper state of a command no matter whether it is in a toolbar or menu.
|
|
Technical Support
|
Oct 25, 2007 - 12:55 PM
|
You should use a CExtThemeSwitcherToolControlBar -derived class in which the following method is implemented: CExtThemeSwitcherToolControlBar::ThemeSwitcher_OnButtonUpdate()
|
|
Torsten Schucht
|
Oct 25, 2007 - 5:31 AM
|
Ok, thats the way I can access the commands from the CExtThemeSwitcherToolControlBar. But my primary question is: How can I get the enable state of a command synchronized to the state of the corresponding menu item?
|
|
Suhai Gyorgy
|
Oct 24, 2007 - 6:05 AM
|
The global command manager can handle many command profiles. This is the reason why most CExtCmdManager methods have the parameter LPCTSTR sProfileName . The Theme switcher toolbar uses a profile of its own, the name of which is stored in its protected m_strCommandProfileName variable. Check out constructor of CExtThemeSwitcherToolControlBar.
Try to change your code like this, when accessing commands of CExtThemeSwitcherToolControlBar:
CString sProfile = g_CmdManager->ProfileNameFromWnd( m_wndToolBarUiLook->GetSafeHwnd() );
|
|
Bangjun Lei
|
Oct 23, 2007 - 2:22 PM
|
Dear Sir./Madam.,
I would also like to append the theme list into the menu of my dialog-based application. Can you teach me how to achieve this goal?
Thanks!
|
|
Technical Support
|
Oct 23, 2007 - 3:12 PM
|
The ProfUIS_Controls sample demonstrates how to implement a theme list in a dialog-based application. The implementation is exactly the same like in a frame-based sample application and based on the theme switcher toolbar. Please take a look at how itās used there.
|
|
Oliver Burkert
|
Oct 23, 2007 - 5:56 AM
|
|
|
Oliver Burkert
|
Oct 25, 2007 - 1:34 AM
|
The bug seems to depend on the screen resolution. Using your RibbonBar-m.exe sample application, I could reproduce the bug on several computers with 1920x1200 resolution, but it works fine with 1280x1024 resolution.
|
|
Technical Support
|
Oct 24, 2007 - 7:03 AM
|
We failed to reproduce this layout problem. But when we run the RibbonBar sample on a slow computer (a several years old Celeron 1GHZ), we noticed the same layout may appear on the screen for a very short time (100-200 ms) and then the ribbon bar re-computes layout of its buttons and everything gets OK. Would you try this sample on several computers? Could you help us reproduce this problem in some way?
|
|
Torsten Schucht
|
Oct 23, 2007 - 5:22 AM
|
Dear Support Team,
I have a problem porting my ProfUIS application from VS2003 to VS2005. I am able to compile and link the Project in VS2005. When I start it, I get an Assert error within the call to g_PaintManager.InstallPaintManager(RUNTIME_CLASS( CExtPaintManagerOffice2007_R2_Obsidian );
This also happens when running an empty project created with the ProfUIS Wizard (all values as default).
The Assert message is as follows: ----------------------------------------------------------------------------------------------------------- Debug Assertion Failed:
Program: d:\SourceCode\Mainline\Client\Program\SenseID.exe File: f:\vs70builds\3077\vc\MFCATL\ship\atlmfc\include\afxwin1.inl Line: 26 ... ----------------------------------------------------------------------------------------------------------- There are two things which confuse me: first I do not have a drive f: on my computer. Second is the directory vs70builds which lets me think that vs2005 is using sources from vs2003.
Do you have any ideas on it?
Thanks in advance
Torsten
|
|
Torsten Schucht
|
Oct 24, 2007 - 1:21 AM
|
As I sad above, the problem was the wrong value of the PATH variable. Now also the "empty project created with the ProfUIS Wizard" works fine.
Torsten
|
|
Technical Support
|
Oct 23, 2007 - 3:11 PM
|
Could you send us this "empty project created with the ProfUIS Wizard" to the support mail box at this web site?
|
|
Torsten Schucht
|
Oct 23, 2007 - 7:54 AM
|
Dear Support Team,
I found the problem and was able to fix it: The PATH environment variable included the "...FOSS Software Inc\Prof-UIS\Bin_7110\" directory which caused the application to load the vs2003 profuis dll. Changing the variable to "...FOSS Software Inc\Prof-UIS\Bin_800\" solves the problem.
This means on the other hand, that it is not possible to use a VS2003 and VS2005 simultaneously.
Torsten
|
|
Torsten Schucht
|
Oct 23, 2007 - 5:59 AM
|
I forgot to mention that I am using ProfUIS version 2.80.
Torsten
|
|
Oliver Burkert
|
Oct 23, 2007 - 1:42 AM
|
In version 2.81, when I move the mouse pointer over the ribbon, the highlighting of the button group vanishes as soon as the pointer is over a button. In version 2.70 it worked correctly and the group stayed highlighted. Could you please fix this?
|
|
David Skok
|
Oct 22, 2007 - 12:44 PM
|
The ReportGridWnd has OnReportGridEmptyDataMessage( strEmptyDataMessage ) to set text in an empty ReportGrid.
A similar feature for CExtGridWnd and CExtTreeGridWnd would be helpful.
Thanks, Dave
|
|
Bangjun Lei
|
Oct 22, 2007 - 7:54 AM
|
Dear Sir./Madam.,
Is there any way to change the color of the border of a dialog?
Thanks!
|
|
Technical Support
|
Oct 22, 2007 - 12:19 PM
|
It is not clear what the border exactly you mean? Would you send us a screenshot that demonstrates what you would like to get? Please note if you mean the non-client area on the dialog sides, this area is part of the system skin. That means you will have to fully repaint the non-client area if you decide on changing its color.
|
|
Ian Hollamby
|
Oct 22, 2007 - 5:49 AM
|
The text color of a disabled combo is different to that of a disabled edit control, is there a reason for this as on my monitor the colors chosen for the combo lack contrast from the background so it is very hard to see the text.
We are using the Obsidian theme.
Is there a way to change the defaults in the theme without having to change every Combo control we define?
Thanks
|
|
Ian Hollamby
|
Nov 29, 2007 - 6:18 AM
|
The Combo’s are drop down lists, please note that the disabled edit controls also have the same problem.
I took the updated version of CExtComboBox and forced all text colors to black still with no result. So the only solution we could come up with is to override the background color used in the Scheme (m_clrFillHint).
//m_clrFillHint = RGB(173,174,189); m_clrFillHint = RGB(203,204,219); // To Improve contrast of text when in Windows XP style
This is not a pretty solution as I am sure you will agree so I would still prefer to change the text color if at all possible, without having to put our own OnPaint handler in for the combo and edit control.
Any ideas??
|
|
Technical Support
|
Nov 28, 2007 - 10:11 AM
|
Unfortunately the text in disabled controls is always gray. Though we process to the CTLCOLOR_STATIC message to change the text color, this does not work unless the control is enabled. There are two workarounds.
1. If you have a Drop Down combo box, you can retrieve a handle of the inner edit control and change it style to READONLY.
2. If your combo box is Drop List, you can make it owner-drawn so the text will be drawn with a correct color regardless if the combo box is enabled or not. NOTE Here is the updated version of CExtComboBox in which some issues are fixed.
|
|
Ian Hollamby
|
Nov 28, 2007 - 6:36 AM
|
Just tried setting the text color to override the Combo Box with the following line to prove I can:
pWnd->SetTextColor(RGB(0,255,0);
but it only works for enabled controls the text color is not changed for disabled ones!
We now are running V2.82
Thanks again for your help
|
|
Ian Hollamby
|
Nov 28, 2007 - 5:55 AM
|
This was indeed down to the PC settings, my PC was set to Windows XP style and the other PC was set to Windows Classic Style. This changed the system colors. I would have thought that when the background color was changed to suit the theme for the disabled controls the text color would also be changed to guarantee the text is visible.
I am now left thinking that we have to override the disabled text color for all controls to make sure our customers don’t complain, as we cannot tell them to change their PC’s style (to a non default setting) to get over this.
Is this something that you can look at again?
|
|
Technical Support
|
Oct 26, 2007 - 7:53 AM
|
The problem can be with different settings of the system appearance. Check the themes installed on these PCās, advanced appearance settings, etc. Anyway you can set a particular text color and a background color yourself.
|
|
Ian Hollamby
|
Oct 22, 2007 - 7:07 AM
|
Sorry wrong information there is no difference between the disabled combo and disabled edit control they are as bad as one another, I was originally looking at a read only edit control.
However there is a difference on disabled text color between two PC’s.
My disabled text is RGB(172,168,153) over background RGB(173,174,189) which is too close, whereas the same program on my colleagues machine is RGB(128,128,128) over the same background.
We are using CExtPaintManagerOffice2007_R2_Obsidian
Thanks
|
|
Adrian M
|
Oct 20, 2007 - 3:15 PM
|
Hi,
I’m trying reduce the size of the prof-uis dll used in my project by uncommenting the #define’s in the profuis.h file and I came across a couple of errors in the prof-uis source code - when I disable the ribbon (__EXT_MFC_NO_RIBBON_BAR), I got errors first in ExtPaintManager that CExtComboBox was missing, so I added this include to the file. Then, I got a link error and it turns out that the following line around line count 5025: #if (!defined __EXT_MFC_NO_RIBBON_BAR)
removes the definition for the method CExtCmdIcon * CExtBarCheckBoxButton::GetIconPtr() which triggers the link error.
I’ll let you know if I find others.
Thanks,
Adrian
|
|
Technical Support
|
Oct 22, 2007 - 12:29 PM
|
You can also reduce the library size by excluding Office2007 paint managers. To do this, just comment out the following line in the Prof-UIS\Include\Resources\resource.rc resource file: #include "Res2007\\Res2007.rc" The last thing you can do is to exclude unneeded international language resources. Just uncomment all the lines for the languages you do not need #define __EXT_MFC_NO_RESOURCES_xxxxxxx Yes, you can use the static linking. You can read more about this in How to link statically with Prof-UIS?
|
|
Adrian M
|
Oct 22, 2007 - 3:07 PM
|
Thanks - removing resources made a big difference in the final size.
One issue though - I couldn’t remvoe the line #include "Res2007\\Res2007.rc" as I use the "luna blue" theme. So what I did in res2007.rc I commented all lines referring to resources other than luna blue, and that worked well. What I would suggest though to make this easier is to provde #define _EXT... for 2007 resources with finer granularity - so we can disable various themes individually.
BTW, the initial size of the dll (release) was over 8 Mb and now is about 2.5 Mb.
After all the changes I made in the prof-uis source, I’m now reluctant to install the new 2.81 version. Fixing the issues I mentioned in your source code would make it much easier for me (and probably others) to upgrade to a new release.
Thanks,
Adrian
|
|
Adrian M
|
Oct 20, 2007 - 3:55 PM
|
Even after removing a lot of the functionality, the ProfUIS280m-RDE.dll is still around 6Mb. Is there anything else I can do to make even smaller?
Would linking with the static version of prof-uis make it smaller yet? I’m thinking that the linker will remove all unused code. My application uses a number of basic features of prof-uis, so a lot of the advanced stuff is not needed. But because my main window is in a dll, I know there could be some runtime issues when linking with the static version of prof-uis and dynamic version of MFC.
Adrian
|
|
Adrian M
|
Oct 20, 2007 - 3:33 PM
|
Another problem: I tried to remove the dynamic bar site, but that caused an error in the NC Frame classes (there is a specialized template
template < > class CExtNCW < CExtDynamicMDIChildWnd > : public CExtDynamicMDIChildWnd , public CExtNcFrameImpl
that causes the error. IMO, this should be ifdef-ed, as I may want to use the NC classes (which is my case), but without support for dunamic bars.
Adrian
|
|
Adrian M
|
Oct 20, 2007 - 3:17 PM
|
BTW, for the second error, I moved the #if(!defined....) line after the GetIconPtr function defintion and that fixed the error.
|
|
Francesco Toscano
|
Oct 19, 2007 - 4:38 AM
|
For some reasons I need to join some cells along a column in a CExtGridWnd. I have used as starting point, your sample "JoinCells". In your sample, the joining is made along cells on the same row, so I have changed the code in order to perform my request. The join works, but I found some strange breaviours with it. First of all the cells selection do not work has expected, if I select the first cell joined in the column (from up to down), the selection works, then if I try to select the other cell the selection do not work.
Can you give me some suggestion and help? This is the code I used to do the join:
void CMyGrid::OnGbwAdjustRects( LONG nColNo, LONG nRowNo, INT nColType, INT nRowType, RECT & rcCellExtraA, RECT & rcCellA ) const { ASSERT_VALID( this ); CExtGridWnd::OnGbwAdjustRects( nColNo, nRowNo, nColType, nRowType, rcCellExtraA, rcCellA );
//if(nColType == 0 && nRowType == 0 && nRowNo == 1) // { // if(nColNo == 1) // { // CRect rcCellA_Next, rcCellExtraA_Next; // if(GridCellRectsGet( // nColNo + 1, // nRowNo, // nColType, // nRowType, // &rcCellA_Next, // &rcCellExtraA_Next)) // { // rcCellA.right = rcCellA_Next.right; // rcCellExtraA.right = rcCellExtraA_Next.right; // } // } // else if(nColNo == 2) // { // rcCellA.left = rcCellA.right; // rcCellExtraA.left = rcCellExtraA.right; // } // } if(nColType == 0 && nRowType == 0) { if(nRowNo == 1 && nColNo == 1) { CRect rcCellA_Next, rcCellExtraA_Next; if(GridCellRectsGet( nColNo, nRowNo + 1, nColType, nRowType, &rcCellA_Next, &rcCellExtraA_Next)) { rcCellA.bottom = rcCellA_Next.bottom; rcCellExtraA.bottom = rcCellExtraA_Next.bottom; } } else if(nRowNo == 2 && nColNo == 1) { rcCellA.top = rcCellA.bottom; rcCellExtraA.top = rcCellExtraA.bottom; } } }
Many thanks Francesco.
|
|
Bangjun Lei
|
Oct 18, 2007 - 7:13 AM
|
Dear Sir./Madam.,
How to add tooltips to all tabs in a tooltab container?
Thanks!
|
|
Technical Support
|
Oct 20, 2007 - 12:06 PM
|
The tab control can display a tooltip for its items if the tab control is configured to show tab items without scrolling and stretch all tab items into entire available width. In this case, if there are too many tab items in the tab window, they may have enough less widths and text on tab items can become displayed partially. As a result, the tab window displays partially shown text of tab items in tooltips. For instance, you can see a tooltip over tabs inside a tabbed group of resizable control bars if this group has 3-4 tabs and less possible width. Itās possible to reproduce the same in the tab window used inside a tabbed toolbar. Unfortunately the tab window does not support custom assigned tooltips. We will consider your message as a feature request.
|
|
Offer Har
|
Oct 18, 2007 - 6:38 AM
|
Dear Support,
I have a grid derived class which i initialize to have one header row on the left side, and one at the top. I would like to access the top-left cell for writing something in it. I understand that this is not supported - Can you please add this to your To Do list, or give me some solution to this problem, as this cell must look and conform with all other cells in the grid.
Thanks, Ron.
|
|
Technical Support
|
Oct 26, 2007 - 11:11 AM
|
This feature is implemented. Please download the updated source code from our ftp server.
|
|
Technical Support
|
Oct 25, 2007 - 12:28 PM
|
This feature is under development and will be available within a week.
|
|
Technical Support
|
Oct 23, 2007 - 3:09 PM
|
In fact, the corner areas in the CExtGridWnd class and all the classes derived from it can contain grid cells and even the data provider supports grid cells in these areas, but we did not implement painting, measuring and printing for grid cells in these areas. It’s not a problem to implement this feature.
|
|
Offer Har
|
Oct 23, 2007 - 3:29 PM
|
Dear Support,
Can you please explain what you mean my that? How do I create it? How do I access it?
Thanks, Ron.
|
|
Technical Support
|
Oct 29, 2007 - 1:44 PM
|
The CExtGridWnd::GridCellGet() virtual method has the INT nColType and INT nRowType parameters. Previously only one of them can have a non-zero value. Now both of them can be non-zero so you can access corner cells.
|
|
Offer Har
|
Oct 29, 2007 - 1:48 PM
|
How do I get the version with this fix?
|
|
Technical Support
|
Oct 30, 2007 - 2:54 PM
|
As a subscriber, you can always download the latest source code from our ftp server. You can request the details at support@prof-uis.com.
|
|
Suhai Gyorgy
|
Oct 30, 2007 - 2:36 AM
|
Send an e-mail from your registered e-mail address to support@prof-uis.com , requesting access to the ftp server. They’ll tell you the details in the answer email.
|
|
Technical Support
|
Oct 18, 2007 - 2:16 PM
|
The grid control does not display cell objects in the corners but you can repaint them if you need to display some information there. You should override the CExtGridBaseWnd::OnGbwEraseArea() virtual method like as follows: void CYourGridWnd::OnGbwEraseArea(
CDC & dc,
const RECT & rcArea,
DWORD dwAreaFlags
) const
{
ASSERT_VALID( this );
ASSERT( dc.GetSafeHdc() != NULL );
COLORREF clrDebugFill = COLORREF( -1L );
switch( dwAreaFlags )
{
case __EGBWA_OUTER_CELLS|__EGBWA_OUTER_TOP:
clrDebugFill = RGB( 255, 128, 128 );
break;
case __EGBWA_OUTER_CELLS|__EGBWA_OUTER_BOTTOM:
clrDebugFill = RGB( 128, 255, 128 );
break;
case __EGBWA_OUTER_CELLS|__EGBWA_OUTER_LEFT:
clrDebugFill = RGB( 128, 128, 255 );
break;
case __EGBWA_OUTER_CELLS|__EGBWA_OUTER_RIGHT:
clrDebugFill = RGB( 128, 255, 255 );
break;
case __EGBWA_OUTER_CELLS|__EGBWA_OUTER_LEFT|__EGBWA_OUTER_TOP:
clrDebugFill = RGB( 255, 128, 255 );
break;
case __EGBWA_OUTER_CELLS|__EGBWA_OUTER_LEFT|__EGBWA_OUTER_BOTTOM:
clrDebugFill = RGB( 255, 255, 128 );
break;
case __EGBWA_OUTER_CELLS|__EGBWA_OUTER_RIGHT|__EGBWA_OUTER_TOP:
clrDebugFill = RGB( 255, 255, 128 );
break;
case __EGBWA_OUTER_CELLS|__EGBWA_OUTER_RIGHT|__EGBWA_OUTER_BOTTOM:
clrDebugFill = RGB( 128, 128, 128 );
break;
case __EGBWA_INNER_CELLS:
clrDebugFill = RGB( 255, 255, 224 );
break;
}
if( clrDebugFill != COLORREF( -1L ) )
dc.FillSolidRect( &rcArea, clrDebugFill );
}
|
|
Offer Har
|
Oct 18, 2007 - 2:48 PM
|
Dear Support,
I understand that I can draw there manually but I think that this cell should be a normal cell, so that we won’t have to work with a DC each time we want to put something in this location. In other grids I worked in the past this was a normal cell, and I think it should be here as well.
Please let me know what you think about this issue.
Regards, Ron.
|
|
Offer Har
|
Oct 23, 2007 - 6:59 AM
|
Dear Support,
Still waiting a reply.
Regards, Ron.
|
|
Pierre MEDART
|
Oct 18, 2007 - 2:29 AM
|
Hi is there a way to limit the number of theme that we display in the CExtThemeSwitcherToolControlBar ?
We need to provide some way to change the ui theme to our user, but for example, we don’t plan to use the Office 2000 theme that looks outdated now.
|
|
Technical Support
|
Oct 18, 2007 - 12:59 PM
|
You can override the ThemeSwitcherInit() method in a CExtThemeSwitcherToolControlBar -derived class and change the method’s body as you wish. Alternatively you can invoke the base class method and then remove the unwanted buttons. Each button represents some paint manager and has identifiers that are declared as follows #define ID_EXT_PM_THEME_Office2000 29901
#define ID_EXT_PM_THEME_OfficeXP 29902
#define ID_EXT_PM_THEME_Office2003 29903
#define ID_EXT_PM_THEME_Office2003NoThemes 29904
#define ID_EXT_PM_THEME_Studio2005 29905
#define ID_EXT_PM_THEME_NativeXP 29906
#define ID_EXT_PM_THEME_Office2007_R1 29907
#define ID_EXT_PM_THEME_Office2007_R2_LunaBlue 29908
#define ID_EXT_PM_THEME_Office2007_R2_Obsidian 29909
|
|
Offer Har
|
Oct 17, 2007 - 4:19 PM
|
Dear Support,
I have a dialog application with controls and group-boxes.
I have a control that I create in my code (not in the resource editor). When I place it inside a group-box it flickers. In the FAQ you solve this problem with changing the tab order, but this control does not exist in the resource editor, because it is only created at run time.
Regards, Ron.
|
|
Technical Support
|
Oct 18, 2007 - 1:19 PM
|
You can change the tab order programmatically. Since version 2.80 there is a SubclassChildControls() global function which can be used for subclassing standard controls with Prof-UIS controls. This function also eliminates the problem of a wrong tab order for the controls used in CExtGroupBox . You can fix only the tab order using the following method void FixGroupBoxesOrder( HWND hWndParent )
{
if( hWndParent == NULL
|| (!::IsWindow( hWndParent ))
)
return;
HWND hWnd = ::GetWindow( hWndParent, GW_CHILD );
HWND hWndLast = NULL;
CDWordArray arrGroupBoxes;
while( hWnd != NULL )
{
TCHAR szCompare[512] = _T("");
::GetClassName(
hWnd,
szCompare,
sizeof( szCompare ) / sizeof( szCompare[0] )
);
if( _tcsicmp( szCompare, _T("BUTTON") ) == 0 )
{
#ifdef BS_TYPEMASK
ASSERT( BS_TYPEMASK == 0x0000000FL );
#endif
DWORD dwWndStyle = (DWORD)::GetWindowLong( hWnd, GWL_STYLE );
if( ( dwWndStyle & 0x0000000FL ) == BS_GROUPBOX )
arrGroupBoxes.Add( DWORD( hWnd ) );
}
hWndLast = hWnd;
hWnd = ::GetWindow( hWnd, GW_HWNDNEXT );
}
if( hWndLast != NULL
&& arrGroupBoxes.GetSize() > 0
)
{
// move all the group boxes to the back by changing the tab order at runtime
HWND hWndPrev = hWndLast;
while( arrGroupBoxes.GetSize() > 0 )
{
HWND hWnd = (HWND) arrGroupBoxes.GetAt( 0 );
if( hWnd != NULL
&& ::IsWindow( hWnd )
)
{
::SetWindowPos(
hWnd,
hWndPrev,
0,0,
0,0,
SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE
);
hWndPrev = hWnd;
}
arrGroupBoxes.RemoveAt( 0 );
}
}
}
|
|
Offer Har
|
Oct 18, 2007 - 2:45 PM
|
|
|
Bangjun Lei
|
Oct 17, 2007 - 2:17 PM
|
Dear Sir./Madam.,
How to add an icon to each menu item without a toolbar?
Thanks!
|
|
Suhai Gyorgy
|
Oct 18, 2007 - 1:38 AM
|
If you only make a new toolbar in the resource, but you don’t make a CExtToolControlBar variable to it in the MainFrame, you can use this code to associate the given icons to the given commands:
g_CmdManager->UpdateFromToolBar( pApp->m_pszProfileName, ID_NEW_TOOLBAR );
There is another solution, though. Check out the following FAQ: How to replace menu/toolbar icons dynamically? The very same code can be used to associate an icon to a command which did not have an icon before.
|
|
Bangjun Lei
|
Oct 17, 2007 - 1:39 PM
|
Dear Sir./Madam.,
I play with the HelpNotes sample. I replace the .rtf with some of my own. Sometimes I found out that the first line in the .rtf is divided into two lines when being displayed. But I don’t want this. Do you know why this would happen? How to correct it?
Thanks!
|
|
Technical Support
|
Oct 20, 2007 - 11:38 AM
|
|
|
Paul Cowan
|
Oct 17, 2007 - 12:57 PM
|
I would like to be able to change grid cells with the cursor keys, while editing a cell, but not have the new cell go in to edit mode. I’ve tried using __EGWS_BSE_WALK, which when set turns on edit mode in the new cell and when not set disables movement with the cursor keys. How do I enable moving cells with the cursor keys, but not re-enable edit mode?
|
|
Technical Support
|
Oct 22, 2007 - 12:40 PM
|
We are sorry for the delay with this reply. Unfortunately this behavior of focus/editing is not supported explicitly in CExtGridWnd . You can override the CExtGridWnd::OnGridCellInplaceControlWindowProc() virtual method in your CExtGridWnd -derived class to intercept messages of the inplace active cell editor window. This will allow you to receive WM_KEYDOWN messages with wParam set to VK_UP or VK_DOWN . If these keys are pressed, then you should set the WM_CANCELMODE message to the hWndInplaceControl window handle specified in the parameters and set a new focused cell by invoking CExtGridWnd::FocusSet() .
|
|
Richard Rodruck
|
Oct 17, 2007 - 9:50 AM
|
I am trying to capture the VK_DELETE message but the CExtGridInplaceEdit message loop doesn’t let it pass through. Is there a way to do so?
|
|
Richard Rodruck
|
Oct 19, 2007 - 9:34 AM
|
|
|
Technical Support
|
Oct 18, 2007 - 1:16 PM
|
Yes we agree with you that this is our fault. You can fix this problem by updating the following method and recompiling the library. Note this fix will be available in Prof-UIS 2.81 bool CExtGridWnd::OnGbwBeginEdit(
LONG nVisibleColNo,
LONG nVisibleRowNo,
LONG nColNo,
LONG nRowNo,
INT nColType,
INT nRowType,
const RECT & rcCellExtra,
const RECT & rcCell,
const RECT & rcInplaceControl,
bool bContinueMsgLoop, // = true
__EXT_MFC_SAFE_LPCTSTR strStartEditText // = NULL
)
{
ASSERT_VALID( this );
if( CExtGridBaseWnd::OnGbwBeginEdit(
nVisibleColNo,
nVisibleRowNo,
nColNo,
nRowNo,
nColType,
nRowType,
rcCellExtra,
rcCell,
rcInplaceControl,
bContinueMsgLoop,
strStartEditText
)
)
return true;
if( CExtPopupMenuWnd::IsMenuTracking() )
CExtPopupMenuWnd::CancelMenuTracking();
CWnd::CancelToolTips();
//DWORD dwBseStyle = BseGetStyle();
// if( nColType < 0 && (dwBseStyle&__EGWS_BSE_EDIT_CELLS_OUTER_L) == 0L )
// return false;
// else if( nColType > 0 && (dwBseStyle&__EGWS_BSE_EDIT_CELLS_OUTER_R) == 0L )
// return false;
// else if( nColType == 0 && (dwBseStyle&__EGWS_BSE_EDIT_CELLS_INNER) == 0L )
// return false;
// else if( nRowType < 0 && (dwBseStyle&__EGWS_BSE_EDIT_CELLS_OUTER_T) == 0L )
// return false;
// else if( nRowType > 0 && (dwBseStyle&__EGWS_BSE_EDIT_CELLS_OUTER_B) == 0L )
// return false;
// else if( nRowType == 0 && (dwBseStyle&__EGWS_BSE_EDIT_CELLS_INNER) == 0L )
// return false;
DWORD dwBseStyle = BseGetStyle();
if( nColType < 0
&& (dwBseStyle&__EGWS_BSE_EDIT_CELLS_OUTER_L) == 0L
)
return false;
else if( nColType > 0
&& (dwBseStyle&__EGWS_BSE_EDIT_CELLS_OUTER_R) == 0L
)
return false;
else if( nRowType < 0
&& (dwBseStyle&__EGWS_BSE_EDIT_CELLS_OUTER_T) == 0L
)
return false;
else if( nRowType > 0
&& (dwBseStyle&__EGWS_BSE_EDIT_CELLS_OUTER_B) == 0L
)
return false;
else if( nColType == 0
&& nRowType == 0
&& (dwBseStyle&__EGWS_BSE_EDIT_CELLS_INNER) == 0L
)
return false;
static CExtGridCell * g_pEditCell = NULL;
bool bDoMsgLoop = true;
if( m_hWndInplaceControl != NULL )
{
if( ! bContinueMsgLoop )
return false;
HWND hWndInplaceControl = m_hWndInplaceControl;
m_hWndInplaceControl = NULL;
if( hWndInplaceControl != NULL )
{
bDoMsgLoop = false;
if( ::IsWindow(hWndInplaceControl) )
::DestroyWindow( hWndInplaceControl );
} // if( hWndInplaceControl != NULL )
} // if( m_hWndInplaceControl != NULL )
CRect rcActivate( rcInplaceControl );
if( rcActivate.left >= rcActivate.right
|| rcActivate.top >= rcActivate.bottom
)
{ // if invalid rect - recalc it
if( ! GridCellRectsGet(
nColNo,
nRowNo,
nColType,
nRowType,
NULL,
NULL,
NULL,
&rcActivate // pRectTextArea
)
)
{
g_pEditCell = NULL;
return false;
}
if( rcActivate.IsRectEmpty() )
{
g_pEditCell = NULL;
return false;
}
} // if invalid rect - recalc it
//CClientDC dc( this );
// dc.FillSolidRect( &rcActivate, RGB(255,0,0) );
//CString strMsg;
//strMsg.Format( _T("CExtGridWnd::OnGbwBeginEdit(%ld,%ld,%ld,%ld,%d,%d)"),nVisibleColNo,nVisibleRowNo,nColNo,nRowNo,nColType,nRowType);
//::AfxMessageBox( strMsg, MB_ICONINFORMATION );
CExtGridCell * pCellToEdit =
GridCellGet(
nColNo,
nRowNo,
nColType,
nRowType
);
if( pCellToEdit == NULL )
return false;
ASSERT_VALID( pCellToEdit );
ASSERT( pCellToEdit->IsKindOf(RUNTIME_CLASS(CExtGridCell)) );
ASSERT_VALID( pCellToEdit->DataProviderGet() );
g_pEditCell = pCellToEdit;
m_hWndInplaceControl =
g_pEditCell->OnInplaceControlCreate(
*this,
nVisibleColNo,
nVisibleRowNo,
nColNo,
nRowNo,
nColType,
nRowType,
rcCellExtra,
rcCell,
rcActivate,
m_nHelperLastEditedColNo,
m_nHelperLastEditedRowNo
);
if( m_hWndInplaceControl == NULL
|| ( ! ::IsWindow( m_hWndInplaceControl ) )
)
{
m_hWndInplaceControl = NULL;
g_pEditCell = NULL;
DWORD dwCellStyle = pCellToEdit->GetStyle();
if( (dwCellStyle&__EGCS_CHK_MASK) == 0 )
{
if( (dwCellStyle&__EGCS_BUTTON_DROPDOWN) != 0 )
{
bool bEnabled = false;
if( pCellToEdit->OnQueryButtonInfo(
INT(CExtGridCell::__EBTT_DROPDOWN),
&bEnabled
)
)
{
if( bEnabled )
{
pCellToEdit->OnButtonPressed(
*this,
INT(CExtGridCell::__EBTT_DROPDOWN),
rcCellExtra,
rcCell,
nVisibleColNo,
nVisibleRowNo,
nColNo,
nRowNo,
nColType,
nRowType
);
return true;
} // if( bEnabled )
}
} // if( (dwCellStyle&__EGCS_BUTTON_DROPDOWN) != 0 )
// -2.63
// if( (dwCellStyle&__EGCS_BUTTON_ELLIPSIS) != 0 )
// {
// bool bEnabled = false;
// if( pCellToEdit->OnQueryButtonInfo(
// INT(CExtGridCell::__EBTT_ELLIPSIS),
// &bEnabled
// )
// )
// {
// if( bEnabled )
// {
// pCellToEdit->OnButtonPressed(
// *this,
// INT(CExtGridCell::__EBTT_ELLIPSIS),
// rcCellExtra,
// rcCell,
// nVisibleColNo,
// nVisibleRowNo,
// nColNo,
// nRowNo,
// nColType,
// nRowType
// );
// return true;
// } // if( bEnabled )
// }
// } // if( (dwCellStyle&__EGCS_BUTTON_ELLIPSIS) != 0 )
} // if( (dwCellStyle&__EGCS_CHK_MASK) == 0 )
return false;
}
m_nHelperLastEditedColNo = nColNo;
m_nHelperLastEditedRowNo = nRowNo;
if( ! bDoMsgLoop )
return true;
CWinThread * pThread = ::AfxGetThread();
ASSERT_VALID( pThread );
if( strStartEditText != NULL )
{
bool bSetText = true;
TCHAR strClassName[512];
::GetClassName( m_hWndInplaceControl, strClassName, 512 );
if( _tcslen( strClassName ) > 0 )
{
__EXT_MFC_STRLWR( strClassName, 512 );
if( _tcsstr( strClassName, _T("edit") ) != NULL
|| _tcsstr( strClassName, _T("riched") ) != NULL
|| _tcsstr( strClassName, _T("sysipaddress32") ) != NULL
)
{
bSetText = false;
HWND hWndInplaceControl = m_hWndInplaceControl;
if( _tcsstr( strClassName, _T("sysipaddress32") ) != NULL )
{
for( HWND hWnd = ::GetWindow( m_hWndInplaceControl, GW_CHILD );
hWnd != NULL;
hWnd = ::GetWindow( hWnd, GW_HWNDNEXT )
)
{
ASSERT( hWnd != NULL );
ASSERT( ::IsWindow(hWnd) );
if( ::GetFocus() == hWnd )
{
hWndInplaceControl = hWnd;
break;
}
}
}
::SendMessage( hWndInplaceControl, EM_SETSEL, WPARAM(0), LPARAM(-1) );
::SendMessage( hWndInplaceControl, EM_REPLACESEL, WPARAM(TRUE), LPARAM(strStartEditText) );
}
} // if( _tcslen( strClassName ) > 0 )
if( bSetText )
::SetWindowText( m_hWndInplaceControl, strStartEditText );
} // if( strStartEditText != NULL )
HWND hWndGrid = m_hWnd;
bool bStopFlag = false;
for( MSG msg;
m_hWndInplaceControl != NULL
&& ::IsWindow( m_hWndInplaceControl )
&& ::IsWindowVisible( m_hWndInplaceControl )
&& ::IsWindow( hWndGrid )
&& (!bStopFlag)
&& (g_pEditCell != NULL)
;
)
{ // in-place editor message loop
if( ! ::PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE) )
{
if( m_hWndInplaceControl == NULL
|| ( ! ::IsWindow( m_hWndInplaceControl ) )
|| ( ! ::IsWindow( hWndGrid ) )
|| bStopFlag
|| g_pEditCell == NULL
)
break;
LONG nIdleCounter = 0L;
for( nIdleCounter = 0L;
g_pEditCell->OnInplaceControlIdle(
m_hWndInplaceControl,
*this,
nIdleCounter
);
nIdleCounter ++
)
{
ASSERT_VALID( g_pEditCell );
}
if( CExtGridWnd::g_bEnableOnIdleCalls )
{
for( nIdleCounter = 0L;
pThread->OnIdle(nIdleCounter);
nIdleCounter ++
);
}
::WaitMessage();
continue;
} // if( ! ::PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE) )
switch( msg.message )
{
case WM_KILLFOCUS:
if( msg.hwnd == m_hWndInplaceControl )
bStopFlag = true;
break;
case WM_CANCELMODE:
case WM_ACTIVATEAPP:
case WM_SYSCOMMAND:
case WM_SETTINGCHANGE:
case WM_SYSCOLORCHANGE:
bStopFlag = true;
break;
case WM_COMMAND:
if( (HIWORD(msg.wParam)) == 0
|| (HIWORD(msg.wParam)) == 1
)
bStopFlag = true;
break;
case WM_CAPTURECHANGED:
if( (HWND)msg.wParam != m_hWndInplaceControl )
bStopFlag = true;
break;
case WM_LBUTTONUP:
case WM_LBUTTONDOWN:
case WM_LBUTTONDBLCLK:
case WM_RBUTTONUP:
case WM_RBUTTONDOWN:
case WM_RBUTTONDBLCLK:
case WM_MBUTTONUP:
case WM_MBUTTONDOWN:
case WM_MBUTTONDBLCLK:
case WM_NCLBUTTONUP:
case WM_NCLBUTTONDOWN:
case WM_NCLBUTTONDBLCLK:
case WM_NCRBUTTONUP:
case WM_NCRBUTTONDOWN:
case WM_NCRBUTTONDBLCLK:
case WM_NCMBUTTONUP:
case WM_NCMBUTTONDOWN:
case WM_NCMBUTTONDBLCLK:
case WM_CONTEXTMENU:
if( msg.hwnd != m_hWndInplaceControl
&& (!::IsChild( m_hWndInplaceControl, msg.hwnd ))
)
bStopFlag = true;
break;
default:
// if( msg.message == WM_SYSKEYDOWN
// || msg.message == WM_SYSKEYUP
// || msg.message == WM_KEYDOWN
// || msg.message == WM_KEYUP
// )
// {
// bool bKeyUp =
// ( msg.message == WM_KEYUP || msg.message == WM_SYSKEYUP )
// ? true : false;
// BOOL bCtrl = ::GetKeyState(VK_CONTROL) & 0x80000000;
// BOOL bShift = ::GetKeyState(VK_SHIFT) & 0x80000000;
// //BOOL bAlt = HIWORD(msg.lParam) & KF_ALTDOWN;
// TCHAR vkTCHAR = (TCHAR)msg.wParam;
// if( vkTCHAR == VK_MENU
// && (!bCtrl) && (!bShift)
// //&& bKeyUp
// )
// bStopFlag = true;
// //else if( bAlt
// // && ( vkTCHAR == VK_SUBTRACT
// // || vkTCHAR == VK_SPACE
// // )
// // )
// // bStopFlag = true;
// }
if( ( ! bStopFlag )
&& WM_KEYFIRST <= msg.message
&& msg.message <= WM_KEYLAST
&& ( msg.hwnd != m_hWndInplaceControl
|| (!::IsChild( m_hWndInplaceControl, msg.hwnd ))
)
)
{
bool bAlt =
( (::GetAsyncKeyState(VK_MENU)&0x8000) != 0 )
? true : false;
bool bCtrl =
( (::GetAsyncKeyState(VK_CONTROL)&0x8000) != 0 )
? true : false;
bool bShift =
( (::GetAsyncKeyState(VK_SHIFT)&0x8000) != 0 )
? true : false;
if( ! bAlt )
{
if( bCtrl
&& (!bShift)
&& ( int(msg.wParam) == VK_INSERT
|| int(msg.wParam) == int( _T(’C’) )
)
)
{
LRESULT lResult = 0L;
g_pEditCell->OnInplaceControlWindowProc(
lResult,
msg.message,
msg.wParam,
msg.lParam,
msg.hwnd,
*this,
nVisibleColNo,
nVisibleRowNo,
nColNo,
nRowNo,
nColType,
nRowType,
rcCellExtra,
rcCell,
rcInplaceControl
);
::PeekMessage(&msg,NULL,msg.message,msg.message,PM_REMOVE);
if( msg.message == WM_KEYDOWN )
::SendMessage( msg.hwnd, WM_COPY, 0, 0 );
continue;
}
if( ( bCtrl && (!bShift) && int(msg.wParam) == int( _T(’V’) ) )
|| ( (!bCtrl) && bShift && int(msg.wParam) == VK_INSERT )
)
{
LRESULT lResult = 0L;
g_pEditCell->OnInplaceControlWindowProc(
lResult,
msg.message,
msg.wParam,
msg.lParam,
msg.hwnd,
*this,
nVisibleColNo,
nVisibleRowNo,
nColNo,
nRowNo,
nColType,
nRowType,
rcCellExtra,
rcCell,
rcInplaceControl
);
::PeekMessage(&msg,NULL,msg.message,msg.message,PM_REMOVE);
if( msg.message == WM_KEYDOWN )
::SendMessage( msg.hwnd, WM_PASTE, 0, 0 );
continue;
}
if( ( bCtrl && (!bShift) && int(msg.wParam) == int( _T(’X’) ) )
|| ( (!bCtrl) && bShift && int(msg.wParam) == VK_DELETE )
)
{
LRESULT lResult = 0L;
g_pEditCell->OnInplaceControlWindowProc(
lResult,
msg.message,
msg.wParam,
msg.lParam,
msg.hwnd,
*this,
nVisibleColNo,
nVisibleRowNo,
nColNo,
nRowNo,
nColType,
nRowType,
rcCellExtra,
rcCell,
rcInplaceControl
);
::PeekMessage(&msg,NULL,msg.message,msg.message,PM_REMOVE);
if( msg.message == WM_KEYDOWN )
{
if( ( g_pEditCell->GetStyle() & __EGCS_READ_ONLY ) == 0 )
::SendMessage( msg.hwnd, WM_CUT, 0, 0 );
else
::SendMessage( msg.hwnd, WM_COPY, 0, 0 );
}
continue;
}
if( bCtrl && (!bShift) && int(msg.wParam) == int( _T(’A’) ) )
{
LRESULT lResult = 0L;
g_pEditCell->OnInplaceControlWindowProc(
lResult,
msg.message,
msg.wParam,
msg.lParam,
msg.hwnd,
*this,
nVisibleColNo,
nVisibleRowNo,
nColNo,
nRowNo,
nColType,
nRowType,
rcCellExtra,
rcCell,
rcInplaceControl
);
::PeekMessage(&msg,NULL,msg.message,msg.message,PM_REMOVE);
if( msg.message == WM_KEYDOWN )
::SendMessage( msg.hwnd, EM_SETSEL, 0, -1 );
continue;
}
if( (!bCtrl) && (!bShift) && int(msg.wParam) == VK_DELETE )
{
if( msg.message != WM_CHAR )
{
LRESULT lResult = 0L;
g_pEditCell->OnInplaceControlWindowProc(
lResult,
msg.message,
msg.wParam,
msg.lParam,
msg.hwnd,
*this,
nVisibleColNo,
nVisibleRowNo,
nColNo,
nRowNo,
nColType,
nRowType,
rcCellExtra,
rcCell,
rcInplaceControl
);
::PeekMessage(&msg,NULL,msg.message,msg.message,PM_REMOVE);
if( msg.message == WM_KEYDOWN )
{
LPTSTR strEmpty = _T("");
INT nSelStart = 0, nSelEnd = 0;
::SendMessage( msg.hwnd, EM_GETSEL, reinterpret_cast < WPARAM > ( &nSelStart ), reinterpret_cast < LPARAM > ( &nSelEnd ) );
if( nSelStart == nSelEnd )
::SendMessage( msg.hwnd, EM_SETSEL, WPARAM( nSelStart ), LPARAM( nSelStart + 1 ) );
if( ( g_pEditCell->GetStyle() & __EGCS_READ_ONLY ) == 0 )
::SendMessage( msg.hwnd, EM_REPLACESEL, 1, reinterpret_cast < LPARAM > ( strEmpty ) );
}
continue;
}
}
} // if( ! bAlt )
if( ( (!bAlt) && bCtrl && (!bShift) && int(msg.wParam) == int( _T(’Z’) ) )
|| ( bAlt && (!bCtrl) && (!bShift) && int(msg.wParam) == VK_BACK )
)
{
LRESULT lResult = 0L;
g_pEditCell->OnInplaceControlWindowProc(
lResult,
msg.message,
msg.wParam,
msg.lParam,
msg.hwnd,
*this,
nVisibleColNo,
nVisibleRowNo,
nColNo,
nRowNo,
nColType,
nRowType,
rcCellExtra,
rcCell,
rcInplaceControl
);
::PeekMessage(&msg,NULL,msg.message,msg.message,PM_REMOVE);
if( msg.message == WM_KEYDOWN )
::SendMessage( msg.hwnd, WM_UNDO, 0, 0 );
continue;
}
}
break;
} // switch( msg.message )
if( bStopFlag )
break;
if( ! pThread->PumpMessage() )
break;
} // in-place editor message loop
g_pEditCell = NULL;
if( ! ::IsWindow( hWndGrid ) )
return true;
ASSERT( CWnd::FromHandlePermanent(hWndGrid) == this );
ASSERT_VALID( this );
m_nHelperLastEditedColNo = -1L;
m_nHelperLastEditedRowNo = -1L;
if( m_hWndInplaceControl != NULL )
{
if( ::IsWindow(m_hWndInplaceControl) )
{
if( ::GetCapture() == m_hWndInplaceControl )
::ReleaseCapture();
::ShowWindow( m_hWndInplaceControl, SW_HIDE );
::SetFocus( m_hWnd ); // after changing focus inplace control kill itself
// ::DestroyWindow( m_hWndInplaceControl );
} // if( ::IsWindow(m_hWndInplaceControl) )
m_hWndInplaceControl = NULL;
} // if( m_hWndInplaceControl != NULL )
return true;
}
|
|
Richard Rodruck
|
Oct 17, 2007 - 5:05 PM
|
The delete key still doesn’t get there. It gets handled in the CExtGridInplaceEdit message loop in ExtGridWnd.cpp and no where else
|
|
Technical Support
|
Oct 17, 2007 - 12:17 PM
|
You should override CExtGridCell::OnInplaceControlWindowProc() in your CExtGridCell -derived class or override the CExtGridWnd::OnGridCellInplaceControlWindowProc() virtual method in your CExtGridWnd -derived class. This will allow you to watch for the messages of the in-place active editor control.
|
|
Bangjun Lei
|
Oct 16, 2007 - 3:00 PM
|
Dear Sir./Madam.,
Are there any examples that show how to add complex tooltip (including icons and texts, somewhat like helpnote) to a report grid header?
Thanks!
|
|
Technical Support
|
Oct 17, 2007 - 12:24 PM
|
There is a sample called HelpNotes that shows how to implement a tooltip-like window based on the rich edit control. The pop-up rich edit control with rich text and in-place OLE objects (bitmaps in this sample) is used instead of toolbar/menu tips. You can do the same with grid windows. There is also a CExtGridWnd::OnAdvancedPopupMenuTipWndDisplay() method is called each time the default CExtPopupMenuTipWnd tooltip window is about to be displayed. So you can override it and display any other tooltip-like window instead including the pop-up window implemented in the HelpNotes.
|
|
Johnny Booth
|
Oct 16, 2007 - 2:52 PM
|
I have a CView class which is using the CExtPPVW template. How can I tell when the user clicks on the Close button to end the print preview session?
There is a CView virtual method OnEndPrintPreview, but for some reason it does not get called in my derived class.
|
|
Technical Support
|
Oct 17, 2007 - 1:14 PM
|
First, please make sure your class is declared as follows class CYourView : public CExtPPVW < CView > The CExtPPVW < CView > template based class in this case is derived from both CView class and CExtPPVW_Printable . The latter one provides a set of virtual methods for handling printing events like in MFC views. But signatures of OnEndPrintPreview() methods in these two classes are different void CView::OnEndPrintPreview(
CDC * pDC,
CPrintInfo * pInfo,
POINT,
CPreviewView * pView
)
void CExtPPVW_Printable::OnEndPrintPreview(
CDC * pDC,
CPrintInfo * pInfo,
POINT point,
CExtPPVW_HostWnd * pWndPrintPreviewHost
) Unfortunately we cannot use the CView::OnEndPrintPreview() signature because CExtPPVW provides the printing and print preview feature not only for MFC views. So make sure you are using the signature of CExtPPVW_Printable::OnEndPrintPreview() . Then find the CDrawView class in the DRAWCLI sample. It represents an MFC view window based on printing and print preview subsystem provided by Prof-UIS. If you add the following method into declaration of this class, then you will see a message box each time you exits the print preview mode. void OnEndPrintPreview(
CDC * pDC,
CPrintInfo * pInfo,
POINT point,
CExtPPVW_HostWnd * pWndPrintPreviewHost
)
{
CExtPPVW_Printable::OnEndPrintPreview(
pDC,
pInfo,
point,
pWndPrintPreviewHost
);
::AfxMessageBox( _T("Print preview mode is off.") );
}
|
|