- // clear the previously selected items
- UnselectAll();
-
- // prevent the click from starting in-place editing
- // which should only happen if we click on the
- // already selected item (and nothing else is
- // selected)
- TreeView_SelectItem(GetHwnd(), 0);
+ // clear the previously selected items, if the
+ // user clicked outside of the present selection.
+ // otherwise, perform the deselection on mouse-up.
+ // this allows multiple drag and drop to work.
+
+ if (IsItemSelected(GetHwnd(), htItem))
+ {
+ ::SetFocus(GetHwnd(), htItem);
+ }
+ else
+ {
+ UnselectAll();
+
+ // prevent the click from starting in-place editing
+ // which should only happen if we click on the
+ // already selected item (and nothing else is
+ // selected)
+
+ TreeView_SelectItem(GetHwnd(), 0);
+ ::SelectItem(GetHwnd(), htItem);
+ }