Applied patch [ 599043 ] fix for wxTreeCtrl/MSW right-click prob

Benjamin I. Williams

There currently is a very significant problem with the
right-click behavior in wxTreeCtrl. The attached patch
file fixes this problem.

To better understand the problem, load up the tree
control, and start right-clicking on items. Note how
the focus rectangle does not behave properly. Next,
enable multiple selection. Now select several items,
and start right-clicking on the selected items. Note
how the selection highlights disappear.

If you try the tree sample with the generic tree
control, you will notice that the problem does not
occur, and that the tree control behaves properly.

This patch brings the MSW tree control implementation
in line with the generic implementation. This is the
same behavior that one can notice in applications such
as windows explorer and Visual Studio.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@16888 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart 2002-08-31 12:12:54 +00:00
parent 70373b5a57
commit de6ac3397d

View File

@ -1990,6 +1990,21 @@ 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))
{
UnselectAll();
}
// select item and set the focus to the
// newly selected item
::SelectItem(GetHwnd(), htItem);
::SetFocus(GetHwnd(), htItem);
break;
#if !wxUSE_CHECKBOXES_IN_MULTI_SEL_TREE
case WM_LBUTTONDOWN:
if ( htItem && isMultiple )