Keep the item being updated selected in wxMSW wxChoice::SetString().

Changing the text of the selected wxChoice (or wxComboBox, as it derives from
it in wxMSW) item made it unselected. Fix this by explicitly restoring the
selection to the item if needed.

Closes #13769.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70018 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2011-12-16 19:47:58 +00:00
parent 5b130f274e
commit b281a92305
2 changed files with 16 additions and 4 deletions

View File

@@ -244,13 +244,16 @@ void ItemContainerTestCase::SetString()
container->Append(testitems);
container->SetSelection(0);
container->SetString(0, "new item 0");
CPPUNIT_ASSERT_EQUAL("new item 0", container->GetString(0));
// Modifying the item shouldn't deselect it.
CPPUNIT_ASSERT_EQUAL(0, container->GetSelection());
// wxOSX doesn't support having empty items in some containers.
#ifndef __WXOSX__
container->SetString(2, "");
#endif
CPPUNIT_ASSERT_EQUAL("new item 0", container->GetString(0));
#ifndef __WXOSX__
CPPUNIT_ASSERT_EQUAL("", container->GetString(2));
#endif
}