How to block tree control from scrolling on item select

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How do I prevent a tree control from scrolling when an item is selected? I have tried handling the WM_VSCROLL message but that only works when the scroll occurs from the scroll bar. When the tree decides on its own to scroll the scroll message is not sent. How do I block this behavior?
 
Hi (e-mail address removed)

Thanks for you posting in the group!
How do I prevent a tree control from scrolling when an item is selected?

I noticed a tree control would scroll automatically to expend its child
nodes when it is double clicked , is it your situation?
I think the scrolling behavior is in order to make room for displaying its
new expended nodes, if you want to block this behavior, you perhaps have to
block the selected item's expanding operation.

If I misunderstand your problem, please reply this message to let me know.


Best regards,

Gary Chang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
 
The problem I'm having is when I select an item with TreeView_SelectItem(), there are times when I have a need for selecting an item that might be offscreen and I don't want the tree to scroll when the item becomes selected. Even when the selection doesn't trigger the tree item to expand its entries, the tree will still scroll.
 
Hi (e-mail address removed),

Thanks for your quickly reply!
The problem I'm having is when I select an item with
TreeView_SelectItem(), there are times when I have a need for selecting an
item that might be offscreen

Does the TreeCtrl control scroll when the item you selected within the
visible field?

How about using the SetItemState method to select the item?


Best regards,

Gary Chang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
 
Hi (e-mail address removed),

Use the following code to select a treectrl item:
pmyTreeCtrl->SetItemState(HItemTarget, TVIS_SELECTED, TVIS_SELECTED);

and to unselect an item,
pmyTreeCtrl->SetItemState(HItemTarget, 0, TVIS_SELECTED);


Best regards,

Gary Chang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
 
Back
Top