-
August 12th, 2003, 11:26 AM
#1
CListView & HDN_ENDTRACK - there stay vertical lines
Hi,
in my CListView-derived class I added handler for HDN_ENDTRACKW notification, which looks like this:
PHP Code:
void CMyFileView::OnEndColumnResizing(NMHDR* pNMHDR, LRESULT* pResult)
{
*pResult = 0;
}
The problem is, that now, after having added this handler, when I'm resizing any column (dragging the divider) and I finish dragging, there stays vertical line pointing from divider perpendicularly to the bottom of ListView. When I handle only HDN_BEGINTRACKW (and set *pResult to 0), everything is ok.
What's the problem with that?
Thank you.
-
April 16th, 2014, 03:39 AM
#2
Re: CListView & HDN_ENDTRACK - there stay vertical lines
After partying 10th anniversary of this problem I finally found a solution for it.
Short story: call CWnd::Default from your HDN_ENDTRACK-handler
Long story:
Just recently I had the same problem and figured out that HDN_ENDTRACK is not only a notification for the end-user, but also a necessary message for the correct drawing (i.e. removing the vertical lines) of the parent list-ctrl: the drawing problem arises the moment you install an MFC-notify-handler for HDN_ENDTRACK.
The difference is then in the function
Code:
// code from MFC: wincore.cpp lines 2133-2140 (MSVC 11, VS 2012)
LRESULT CWnd::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
// OnWndMsg does most of the work, except for DefWindowProc call
LRESULT lResult = 0;
if (!OnWndMsg(message, wParam, lParam, &lResult))
lResult = DefWindowProc(message, wParam, lParam);
return lResult;
}
that for the HDN_ENDTRACK-notification OnWndMsg will return TRUE if and ony if there is a handler for it and thus, if there is a handler won't call DefWindowProc.
As there doesn't exists a OnNotifyEx-handler (blame whoever you want) IMO the best way to handle it is calling CWnd::Default() from your HDN_ENDTRACK-handler.
regards
Tobias
Originally Posted by s_k
Hi,
in my CListView-derived class I added handler for HDN_ENDTRACKW notification, which looks like this:
PHP Code:
void CMyFileView::OnEndColumnResizing(NMHDR* pNMHDR, LRESULT* pResult) { *pResult = 0; }
The problem is, that now, after having added this handler, when I'm resizing any column (dragging the divider) and I finish dragging, there stays vertical line pointing from divider perpendicularly to the bottom of ListView. When I handle only HDN_BEGINTRACKW (and set *pResult to 0), everything is ok.
What's the problem with that?
Thank you.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|