How to highlight items in CTreeCtrl?
-
I tried to use CTreeCtrl::SetItemState, setting the flag TVIS_SELECTED. But I found that only one items was highlighted. How can I highlight a set of items? Thanks
-
I tried to use CTreeCtrl::SetItemState, setting the flag TVIS_SELECTED. But I found that only one items was highlighted. How can I highlight a set of items? Thanks
TreeCtrl does not natively support multiple selection you will probably need to track selection state externally and use customdraw etc etc. Maybe block tvn_selectionchanging, listen to mouse leftclick and evaluate it in conjunction with keyboard state using HTREEITEM TreeView_HitTest(HWND hwndTV, LPTVHITTESTINFO lpht) or similar. Its not a simple ask. You also need to define behaviour such as whether selecting a parent node auto selects all its children and whether the user can select nodes at varying different levels of the tree at the same time.