double click handling is finally correct in the treectrl

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11434 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2001-08-21 15:17:48 +00:00
parent 15248e43a9
commit ebb987b77b

View File

@@ -2731,26 +2731,23 @@ void wxGenericTreeCtrl::OnMouse( wxMouseEvent &event )
m_renameTimer->Stop(); m_renameTimer->Stop();
m_lastOnSame = FALSE; m_lastOnSame = FALSE;
if (item->HasPlus() && !HasButtons()) // send activate event first
wxTreeEvent nevent( wxEVT_COMMAND_TREE_ITEM_ACTIVATED, GetId() );
nevent.m_item = (long) item;
nevent.m_code = 0;
CalcScrolledPosition(x, y,
&nevent.m_pointDrag.x,
&nevent.m_pointDrag.y);
nevent.SetEventObject( this );
if ( !GetEventHandler()->ProcessEvent( nevent ) )
{ {
// If the control has no buttons,the only way // if the user code didn't process the activate event,
// to expand/collapse it is by double clicking // handle it ourselves by toggling the item when it is
// an item. In this case we cannot send any // double clicked
// activate event. if ( item->HasPlus() )
Toggle(item); {
} Toggle(item);
else }
{
// If we have buttons, just send activate event.
wxTreeEvent nevent( wxEVT_COMMAND_TREE_ITEM_ACTIVATED,
GetId() );
nevent.m_item = (long) item;
nevent.m_code = 0;
CalcScrolledPosition(x, y,
&nevent.m_pointDrag.x,
&nevent.m_pointDrag.y);
nevent.SetEventObject( this );
GetEventHandler()->ProcessEvent( nevent );
} }
} }
} }