diff --git a/docs/changes.txt b/docs/changes.txt index cd9d7bb5b4..fdd6aba19e 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -75,6 +75,8 @@ All: - Handle strings with embedded NULs in wxDataStream (Nitch). - Don't crash in wxTextFile::GetLastLine() if the file is empty (crohr). - Add wxString::cbegin() and cend() method (Lauri Nurmi). +- Return proper value from wxIAccessible::get_accSelection() if no children + are selected. All (GUI): diff --git a/interface/wx/access.h b/interface/wx/access.h index fbbac06dfb..91c14f0db4 100644 --- a/interface/wx/access.h +++ b/interface/wx/access.h @@ -355,11 +355,13 @@ public: Gets a variant representing the selected children of this object. Acceptable values are: - @li a null variant (IsNull() returns @true) - @li a list variant (GetType() == "list") + @li a null variant (@c IsNull() returns @true) if no children + are selected + @li a @c void* pointer to a wxAccessible of selected child object @li an integer representing the selected child element, - or 0 if this object is selected (GetType() == "long") - @li a "void*" pointer to a wxAccessible child object + or 0 if this object is selected (@c GetType() @c == @c "long") + @li a list variant (@c GetType() @c == @c "list") if multiple child + objects are selected */ virtual wxAccStatus GetSelections(wxVariant* selections); diff --git a/src/msw/ole/access.cpp b/src/msw/ole/access.cpp index 00a5ac1002..e6ed106c68 100644 --- a/src/msw/ole/access.cpp +++ b/src/msw/ole/access.cpp @@ -1503,7 +1503,13 @@ STDMETHODIMP wxIAccessible::get_accSelection ( VARIANT * pVarChildren) } else { - if (selections.GetType() == wxT("long")) + if ( selections.IsNull() ) + { + pVarChildren->vt = VT_EMPTY; + + return S_OK; + } + else if (selections.GetType() == wxT("long")) { pVarChildren->vt = VT_I4; pVarChildren->lVal = selections.GetLong(); @@ -1526,6 +1532,8 @@ STDMETHODIMP wxIAccessible::get_accSelection ( VARIANT * pVarChildren) } else if (selections.GetType() == wxT("list")) { + wxASSERT_MSG( selections.GetCount() > 1, + wxS("Multiple child objects should be selected") ); // TODO: should we AddRef for every "void*" member?? wxIEnumVARIANT* enumVariant = new wxIEnumVARIANT(selections);