Don't scroll when inserting items into wxListBox in wxOSX

This seems to have been needed in the past (see #12365), but is not
needed any more and results in unexpectedly scrolling down to the last
inserted item, which is undesirable and inconsistent with the other
platforms.

Simply revert f58438058b (Show the first, not the last, inserted item in
wxListBox in wxOSX., 2010-11-05) to fix this.

Closes #18861.
This commit is contained in:
Andreas Falkenhahn
2020-12-05 22:45:13 +01:00
committed by Vadim Zeitlin
parent 04a7a3f150
commit f7d50ed18c

View File

@@ -367,14 +367,6 @@ int wxListBox::DoInsertItems(const wxArrayStringsAdapter& items,
GetListPeer()->UpdateLineToEnd(startpos);
// Inserting the items may scroll the listbox down to show the last
// selected one but we don't want to do it as it could result in e.g. the
// first items of a listbox be hidden immediately after its creation so
// show the first selected item instead. Ideal would probably be to
// preserve the old selection unchanged, in fact, but I don't know how to
// get the first visible item so for now do at least this.
SetFirstItem(startpos);
InvalidateBestSize();
UpdateOldSelections();