Saving contents of windows 'underneath' MenuBar |
Post Reply |
Author | |
asparagusx
Groupie Joined: 06 February 2007 Status: Offline Points: 53 |
Post Options
Thanks(0)
Posted: 08 February 2007 at 9:28am |
Hallo I am implementing the XTP library into a CAD (computer aided design) system and so far so good!
However, I have come across an issue when displaying a 'context menu' e.g. user right clicks, the menu displays (I am using CXTPCommandBars::TrackPopupMenu(pSubMenu, TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y, pMain,0,0,pMain->pCommandBars);
) The menu displays correctly but when the menu is hidden, our application receives a large number of 'redraw requests', which then forces a refresh of the area previously under the contect menu.
Question - is it possible to 'save' the contents of the underlying window(s), prior to displaying the context and then restoring it afterwards (e.g. CS_SAVEBITS | CS_BYTEALIGNWINDOW) to minimise calls to what could be very complex graphics.
Anton Heymann
|
|
asparagusx
Groupie Joined: 06 February 2007 Status: Offline Points: 53 |
Post Options
Thanks(0)
|
Anybody any ideas about this. It has actually turned out to be a serious issue as performance is of absolute importance in this application.
Thank you in advance.
Anton Heymann
|
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hi,
1 What version of Toolkit do you have? Actually we use CS_SAVEBITS and I tried to show popup in our sample and it doesn't generate WM_PAINT messages at all.
2. if performance of drawing is so critical, I very recommend you start cashing drawing, like we do in our Report and Ribbon - it gave us great perfomance.
Something like:
if ( (IsChanged() || m_bmpCache.GetSafeHandle() == 0))
{ CDC memDC; memDC.CreateCompatibleDC(&dc); m_bmpCache.DeleteObject();
m_bmpCache.CreateCompatibleBitmap(&dc, rc.Width(), rc.Height()); CBitmap* pOldBitmap = memDC.SelectObject(&m_bmpCache); OnDraw(&memDC);
dc.BitBlt(0, 0, rc.right, rc.bottom, &memDC, 0, 0, SRCCOPY); memDC.SelectObject(pOldBitmap);
} else { CXTPCompatibleDC memDC(&dc, &m_bmpCache); dc.BitBlt(0, 0, rc.right, rc.bottom, &memDC, 0, 0, SRCCOPY); } |
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
asparagusx
Groupie Joined: 06 February 2007 Status: Offline Points: 53 |
Post Options
Thanks(0)
|
Oleg Thanks for the reply. I have been looking at this in detail and I can see (from the source - we use 10.4.2), that CS_SAVEBITS is only used when creating Popup's and Shadow windows. The code for CXTPControlBars (or derived classes) does not appear to use this at all. I also tried setting
bUseSystemSaveBitsStyle = TRUE, but it appears that is the default in any case and made no difference. When I use TrackPopupmenu, I certainly get redraw requests sent to the application. I used BCMenu before (CodeGuru) and it certainly was not a problem there. I am obviously optimising redraws as much as possible and already use MemDC where possible. I do believe that the solution is for Codejock to add CS_SAVEBITS to additional controls, such as CXTBControlBars and derivitaves. When I 'drag' toolbars accross our application (when repositioning them) the resulting loss of performance is substantial and end-users will not be able to use the system. Thanks Anton
|
|
asparagusx
Groupie Joined: 06 February 2007 Status: Offline Points: 53 |
Post Options
Thanks(0)
|
Oleg To add to the problem, it appears that when the popup menu is hidden (e.g. it is removed from the window), the client area underneath the popup (the area where our drawing is being displayed in) is totally invalidated e.g. InvalidateRect(NULL), rather than InvalidateRect(the screen area of the popup). I am making assumptions here re the drawing code, but my application is certainly receiving (via test to ::RectVisible) that the entire client are has been invalidated. Anton
|
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |