Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - Saving contents of windows 'underneath' MenuBar
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Saving contents of windows 'underneath' MenuBar

 Post Reply Post Reply
Author
Message
asparagusx View Drop Down
Groupie
Groupie


Joined: 06 February 2007
Status: Offline
Points: 46
Post Options Post Options   Thanks (0) Thanks(0)   Quote asparagusx Quote  Post ReplyReply Direct Link To This Post Topic: Saving contents of windows 'underneath' MenuBar
    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
Back to Top
asparagusx View Drop Down
Groupie
Groupie


Joined: 06 February 2007
Status: Offline
Points: 46
Post Options Post Options   Thanks (0) Thanks(0)   Quote asparagusx Quote  Post ReplyReply Direct Link To This Post Posted: 09 February 2007 at 7:51am
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
 
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 09 February 2007 at 9:03am
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
Back to Top
asparagusx View Drop Down
Groupie
Groupie


Joined: 06 February 2007
Status: Offline
Points: 46
Post Options Post Options   Thanks (0) Thanks(0)   Quote asparagusx Quote  Post ReplyReply Direct Link To This Post Posted: 09 February 2007 at 9:21am

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
Back to Top
asparagusx View Drop Down
Groupie
Groupie


Joined: 06 February 2007
Status: Offline
Points: 46
Post Options Post Options   Thanks (0) Thanks(0)   Quote asparagusx Quote  Post ReplyReply Direct Link To This Post Posted: 09 February 2007 at 9:44am

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
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.157 seconds.