Tree Control Shift + MouseWheel
When I scroll the tree control using mousewheel with the shift button pressed, the node under the cursor is being highlighted. Does anyone know how to prevent this? Thank you.
[175 byte] By [
candidate] at [2007-11-19 6:40:06]

# 1 Re: Tree Control Shift + MouseWheel
If you are using CTreeCtrl in a dialog derive your class and handle TVN_SELCHANGING notification.
Use code below:
void CScrollTreeView::OnSelchanging(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;
*pResult = 0;
if((GetAsyncKeyState(VK_SHIFT) < 0) && !m_LButtonDnFlag)
{
TRACE("%d\n", m_LButtonDnFlag);
*pResult = 1;
}
m_LButtonDnFlag = FALSE;
}
Since TVN_SELCHANGING handler is not call when mouse left button is down, I used flag that is initially set to false and set TRUE in WM_LBUTTONDOWN handler.
It is done to allow selection with shift and mouse button down.
JohnCz at 2007-11-11 0:30:16 >
