Fix wxDataViewCtrlAccessible::DoDefaultAction

Calling wxDataViewTreeNode::ToggleOpen() is not sufficient to actually expand/collapse the item.
Calls to wxDataViewMainWindow::Expand()/Collapse() are necessary to do so.
This commit is contained in:
Artur Wieczorek
2016-10-27 21:19:05 +02:00
parent da370db5ed
commit eeaa613705

View File

@@ -5828,13 +5828,17 @@ wxAccStatus wxDataViewCtrlAccessible::DoDefaultAction(int childId)
wxDataViewMainWindow* dvWnd = wxDynamicCast(dvCtrl->GetMainWindow(), wxDataViewMainWindow); wxDataViewMainWindow* dvWnd = wxDynamicCast(dvCtrl->GetMainWindow(), wxDataViewMainWindow);
if ( !dvWnd->IsList() ) if ( !dvWnd->IsList() )
{ {
wxDataViewTreeNode* node = dvWnd->GetTreeNodeByRow(childId-1); const unsigned int row = childId-1;
wxDataViewTreeNode* node = dvWnd->GetTreeNodeByRow(row);
if ( node ) if ( node )
{ {
if ( node->HasChildren() ) if ( node->HasChildren() )
{ {
// Expand or collapse the node. // Expand or collapse the node.
node->ToggleOpen(); if ( node->IsOpen() )
dvWnd->Collapse(row);
else
dvWnd->Expand(row);
return wxACC_OK; return wxACC_OK;
} }
} }