tal031697
asked on
ClistCtrl Sorting Header Refresh
I need to change ClistCtrl sorting headers from time to time
I tried to:
1. SetRedraw(FALSE)
2. delete sorting headers
3. put new sorting headers
3. SetRedraw(TRUE)
Problem: I allways see headers being deleted
and drawn back again, How to hide these refresh????
but I still see
I tried to:
1. SetRedraw(FALSE)
2. delete sorting headers
3. put new sorting headers
3. SetRedraw(TRUE)
Problem: I allways see headers being deleted
and drawn back again, How to hide these refresh????
but I still see
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks.
LockWindowUpdate() did work!.
(I don't know why SetRedraw() didn't).
LockWindowUpdate() did work!.
(I don't know why SetRedraw() didn't).
One reason my be that SetRedraw() is supposed to be handled by the control by it self, and LockWindowUpdate() is handled internally by windows. (Windows queues up the WM_PAINT messages and sends them to the control when UnlockWindowUpdate() is called).
ASKER
Well...
After I swapped SetRedraw() with LockWindowUpdate()
I remembered why I did try this once back, but Abandoned this
approach.
!!!CALLING UnlockWindowUpdate() REFRESHES THE WHOLE DESKTOP!!!!
so right now I'm back with SetRedraw() again.
I still need help,any other suggestions....?
After I swapped SetRedraw() with LockWindowUpdate()
I remembered why I did try this once back, but Abandoned this
approach.
!!!CALLING UnlockWindowUpdate() REFRESHES THE WHOLE DESKTOP!!!!
so right now I'm back with SetRedraw() again.
I still need help,any other suggestions....?
Hmmm, yes I'v seen this as well.
Here is a possible other solution:
Subclass the CListCtrl add a handler for the WM_PAINT message. Add a flag that determines if WM_PAINT messages are to be handled. Set this flag to false when you update the listctrl, and to true when done and call Invalidate() on the entire ListCtrl.
void CMyListCtrl::OnPaint(CDC* pDC)
{
if(m_bDoDraw)
{
CListCtrl::OnPaint(pDC);
}
}
Here is a possible other solution:
Subclass the CListCtrl add a handler for the WM_PAINT message. Add a flag that determines if WM_PAINT messages are to be handled. Set this flag to false when you update the listctrl, and to true when done and call Invalidate() on the entire ListCtrl.
void CMyListCtrl::OnPaint(CDC* pDC)
{
if(m_bDoDraw)
{
CListCtrl::OnPaint(pDC);
}
}
ASKER
Nop!, it didn't work.
even with the 'bDoDraw' flag I can sea the headers
being deleted and added.
... 8-(
even with the 'bDoDraw' flag I can sea the headers
being deleted and added.
... 8-(
Could you post the code for 'delete sorting headers' and 'put new sorting headers' so that I can try some solutions?
In order to handle the WM_MY_MESSAGE message, and this line just above END_MESSAGE_MAP() in the .cpp file:
ON_MESSAGE(WM_MY_MESSAGE, MyHandler)
and, add the declaration of the function to the class header
class MyClass...
{
...
LRESULT MyHandler(WPARAM, LPARAM);
....
};