don't assert when right/down cursor arrows are used in an empty tree control with wxTR_HIDE_ROOT style [backport of patch 1756184 from trunk]
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@47561 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -2795,7 +2795,11 @@ void wxGenericTreeCtrl::OnChar( wxKeyEvent &event )
|
|||||||
case WXK_RIGHT:
|
case WXK_RIGHT:
|
||||||
// this works the same as the down arrow except that we
|
// this works the same as the down arrow except that we
|
||||||
// also expand the item if it wasn't expanded yet
|
// also expand the item if it wasn't expanded yet
|
||||||
|
if (m_current != GetRootItem() || !HasFlag(wxTR_HIDE_ROOT))
|
||||||
Expand(m_current);
|
Expand(m_current);
|
||||||
|
//else: don't try to expand hidden root item (which can be the
|
||||||
|
// current one when the tree is empty)
|
||||||
|
|
||||||
// fall through
|
// fall through
|
||||||
|
|
||||||
case WXK_DOWN:
|
case WXK_DOWN:
|
||||||
@@ -2804,6 +2808,9 @@ void wxGenericTreeCtrl::OnChar( wxKeyEvent &event )
|
|||||||
{
|
{
|
||||||
wxTreeItemIdValue cookie;
|
wxTreeItemIdValue cookie;
|
||||||
wxTreeItemId child = GetFirstChild( m_key_current, cookie );
|
wxTreeItemId child = GetFirstChild( m_key_current, cookie );
|
||||||
|
if ( !child )
|
||||||
|
break;
|
||||||
|
|
||||||
DoSelectItem( child, unselect_others, extended_select );
|
DoSelectItem( child, unselect_others, extended_select );
|
||||||
m_key_current=(wxGenericTreeItem*) child.m_pItem;
|
m_key_current=(wxGenericTreeItem*) child.m_pItem;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user