DebugQ - De:Bug:Q

Go Back   DebugQ - De:Bug:Q > DebugQ > Win32
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
Thread Tools Display Modes
  #1  
Unread 11-04-2008, 02:32 AM
Debugger Debugger is offline
Administrator
 
Join Date: Oct 2007
Posts: 941
Default CListCtrl repaint missing

Q:
CListCtrl is having repaint issue, while running under CDialog and CTabCtrl.
The classes diagram:
Code:
CMDIFrameWnd
	(MDIClient: no MFC class)
		CMDIChildWnd
			CFormView
				CTabCtrl
				CDialog
					CListCtrl


   

Reply With Quote
  #2  
Unread 11-04-2008, 02:36 AM
Debugger Debugger is offline
Administrator
 
Join Date: Oct 2007
Posts: 941
Default

The reason that cause CListCtrl unpainted is because WM_PAINT message routing.
CListCtrl will first get WM_PAINT and repaints itself, and then CTabCtrl, CDialog;
which means while CTabCtrl repaints itself, CListCtrl will be covered.
Since CListCtrl is already repainted, then we cannot see CListCtrl displayed on the screen correctly.


The way to reproduce this sceanrio is:
1. Put focus on CListCtrl
2. Make it repaint.


   


Last edited by Debugger : 11-04-2008 at 02:43 AM.
Reply With Quote
  #3  
Unread 11-04-2008, 02:37 AM
Debugger Debugger is offline
Administrator
 
Join Date: Oct 2007
Posts: 941
Default

A:

1. One (probably) best but no-idea-why solution will be:

Put the following code in the CDialog::OnInitDialog().
Code:
this->SetWindowPos(&wndTop, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE|SWP_NOOWNERZORDER);
http://www.codeguru.com/forum/showpo...3&postcount=16



2. Another approach but may not always work:
Quote:
Just put whatever you have in your tab control ahead of the tab control itself in the tab order of the dialog. Like if the tab order number of the tab control is 10, all the control in it should be below 10 ( 1 - 9 ).
http://www.codeguru.com/forum/showpo...62&postcount=7



3. Dirty but straightforward solution:
Code:
void CDlgSequenceControl::OnPaint()
{

CPaintDC dc(this); // device context for painting

m_ListFigure.Invalidate(TRUE); // THIS IS A BUG WORKAROUND!!! of microsoft bug: wrong repaint order

// Do not call CDialog::OnPaint() for painting messages
}
or
Code:
myCListCtrl.RedrawWindow(NULL,NULL,RDW_FRAME | RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW);
http://www.codeguru.com/forum/showpo...05&postcount=3


   

Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is On
Forum Jump


All times are GMT. The time now is 02:57 AM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
DebugQ - Debug Quote - De:Bug:Q