From f7d50ed18c6e6e7d834266c451c1b11d4d82713c Mon Sep 17 00:00:00 2001 From: Andreas Falkenhahn Date: Sat, 5 Dec 2020 22:45:13 +0100 Subject: [PATCH] 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. --- src/osx/listbox_osx.cpp | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/osx/listbox_osx.cpp b/src/osx/listbox_osx.cpp index e97d1b6c88..e153fb48a1 100644 --- a/src/osx/listbox_osx.cpp +++ b/src/osx/listbox_osx.cpp @@ -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();