X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/cb0afb266214f827417c42474168c7edda7c953e..3398cf2cf6cc2eaae7de6d8b3666229092439078:/src/msw/treectrl.cpp?ds=inline diff --git a/src/msw/treectrl.cpp b/src/msw/treectrl.cpp index baaccbd974..f0f9fa1725 100644 --- a/src/msw/treectrl.cpp +++ b/src/msw/treectrl.cpp @@ -2134,10 +2134,10 @@ long wxTreeCtrl::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) switch ( nMsg ) { case WM_RBUTTONDOWN: - // if the item we are about to right click on - // is not already select, remove the entire - // previous selection - if (!::IsItemSelected(GetHwnd(), htItem)) + // if the item we are about to right click on is not already + // selected or if we click outside of any item, remove the + // entire previous selection + if ( !htItem || !::IsItemSelected(GetHwnd(), htItem) ) { UnselectAll(); }