From c9c4b3a009ce2bbdf47121b6913f5dee7c12992e Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Tue, 21 Aug 2001 11:12:42 +0000 Subject: [PATCH] Fixed focus event problems with control derived from wxScrolledWindow. If wxTreeCtrl has no +/. button, toggle branch, otherwise send activate event upon double-click. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11432 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/generic/treectlg.cpp | 9 ++++++--- src/gtk/scrolwin.cpp | 2 ++ src/gtk1/scrolwin.cpp | 2 ++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/generic/treectlg.cpp b/src/generic/treectlg.cpp index 4c72c6ac75..7f880bb4d9 100644 --- a/src/generic/treectlg.cpp +++ b/src/generic/treectlg.cpp @@ -2731,14 +2731,17 @@ void wxGenericTreeCtrl::OnMouse( wxMouseEvent &event ) m_renameTimer->Stop(); m_lastOnSame = FALSE; - if (item->HasPlus()) + if (item->HasPlus() && !HasButtons()) { - // for a "directory" node, toggle expansion + // If the control has no buttons,the only way + // to expand/collapse it is by double clicking + // an item. In this case we cannot send any + // activate event. Toggle(item); } else { - // for a "file" node, activate it + // If we have buttons, just send activate event. wxTreeEvent nevent( wxEVT_COMMAND_TREE_ITEM_ACTIVATED, GetId() ); nevent.m_item = (long) item; diff --git a/src/gtk/scrolwin.cpp b/src/gtk/scrolwin.cpp index 46cefd3e0f..2f5bd81523 100644 --- a/src/gtk/scrolwin.cpp +++ b/src/gtk/scrolwin.cpp @@ -298,6 +298,8 @@ bool wxScrolledWindow::Create(wxWindow *parent, if (m_parent) m_parent->DoAddChild( this ); + + m_focusWidget = m_wxwindow; PostCreation(); diff --git a/src/gtk1/scrolwin.cpp b/src/gtk1/scrolwin.cpp index 46cefd3e0f..2f5bd81523 100644 --- a/src/gtk1/scrolwin.cpp +++ b/src/gtk1/scrolwin.cpp @@ -298,6 +298,8 @@ bool wxScrolledWindow::Create(wxWindow *parent, if (m_parent) m_parent->DoAddChild( this ); + + m_focusWidget = m_wxwindow; PostCreation(); -- 2.47.2