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
This commit is contained in:
Robert Roebling
2001-08-21 11:12:42 +00:00
parent decb3a6a16
commit c9c4b3a009
3 changed files with 10 additions and 3 deletions

View File

@@ -2731,14 +2731,17 @@ void wxGenericTreeCtrl::OnMouse( wxMouseEvent &event )
m_renameTimer->Stop(); m_renameTimer->Stop();
m_lastOnSame = FALSE; 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); Toggle(item);
} }
else else
{ {
// for a "file" node, activate it // If we have buttons, just send activate event.
wxTreeEvent nevent( wxEVT_COMMAND_TREE_ITEM_ACTIVATED, wxTreeEvent nevent( wxEVT_COMMAND_TREE_ITEM_ACTIVATED,
GetId() ); GetId() );
nevent.m_item = (long) item; nevent.m_item = (long) item;

View File

@@ -299,6 +299,8 @@ bool wxScrolledWindow::Create(wxWindow *parent,
if (m_parent) if (m_parent)
m_parent->DoAddChild( this ); m_parent->DoAddChild( this );
m_focusWidget = m_wxwindow;
PostCreation(); PostCreation();
Show( TRUE ); Show( TRUE );

View File

@@ -299,6 +299,8 @@ bool wxScrolledWindow::Create(wxWindow *parent,
if (m_parent) if (m_parent)
m_parent->DoAddChild( this ); m_parent->DoAddChild( this );
m_focusWidget = m_wxwindow;
PostCreation(); PostCreation();
Show( TRUE ); Show( TRUE );