generate key events for Space/Enter in addition to the activate events, as wxMSW does
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@16934 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1512,13 +1512,13 @@ void wxGenericTreeCtrl::ExpandAll(const wxTreeItemId& item)
|
|||||||
if ( !IsExpanded(item) )
|
if ( !IsExpanded(item) )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
long cookie;
|
long cookie;
|
||||||
wxTreeItemId child = GetFirstChild(item, cookie);
|
wxTreeItemId child = GetFirstChild(item, cookie);
|
||||||
while ( child.IsOk() )
|
while ( child.IsOk() )
|
||||||
{
|
{
|
||||||
ExpandAll(child);
|
ExpandAll(child);
|
||||||
|
|
||||||
child = GetNextChild(item, cookie);
|
child = GetNextChild(item, cookie);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2515,12 +2515,20 @@ void wxGenericTreeCtrl::OnChar( wxKeyEvent &event )
|
|||||||
|
|
||||||
case ' ':
|
case ' ':
|
||||||
case WXK_RETURN:
|
case WXK_RETURN:
|
||||||
|
if ( !event.HasModifiers() )
|
||||||
{
|
{
|
||||||
wxTreeEvent event( wxEVT_COMMAND_TREE_ITEM_ACTIVATED, GetId() );
|
wxTreeEvent event( wxEVT_COMMAND_TREE_ITEM_ACTIVATED, GetId() );
|
||||||
event.m_item = (long) m_current;
|
event.m_item = (long) m_current;
|
||||||
event.SetEventObject( this );
|
event.SetEventObject( this );
|
||||||
GetEventHandler()->ProcessEvent( event );
|
GetEventHandler()->ProcessEvent( event );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// in any case, also generate the normal key event for this key,
|
||||||
|
// even if we generated the ACTIVATED event above: this is what
|
||||||
|
// wxMSW does and it makes sense because you might not want to
|
||||||
|
// process ACTIVATED event at all and handle Space and Return
|
||||||
|
// directly (and differently) which would be impossible otherwise
|
||||||
|
event.Skip();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// up goes to the previous sibling or to the last
|
// up goes to the previous sibling or to the last
|
||||||
@@ -2664,14 +2672,14 @@ void wxGenericTreeCtrl::OnChar( wxKeyEvent &event )
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
// do not use wxIsalnum() here
|
// do not use wxIsalnum() here
|
||||||
if ( !event.HasModifiers() &&
|
if ( !event.HasModifiers() &&
|
||||||
((keyCode >= '0' && keyCode <= '9') ||
|
((keyCode >= '0' && keyCode <= '9') ||
|
||||||
(keyCode >= 'a' && keyCode <= 'z') ||
|
(keyCode >= 'a' && keyCode <= 'z') ||
|
||||||
(keyCode >= 'A' && keyCode <= 'Z' )))
|
(keyCode >= 'A' && keyCode <= 'Z' )))
|
||||||
{
|
{
|
||||||
// find the next item starting with the given prefix
|
// find the next item starting with the given prefix
|
||||||
char ch = (char)keyCode;
|
char ch = (char)keyCode;
|
||||||
|
|
||||||
wxTreeItemId id = FindItem(m_current, m_findPrefix + (wxChar)ch);
|
wxTreeItemId id = FindItem(m_current, m_findPrefix + (wxChar)ch);
|
||||||
if ( !id.IsOk() )
|
if ( !id.IsOk() )
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user