X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b5b208a1796ecf1b9ab267d200705b4f3b4d10e3..fc684792c6b050fbfeabbea92e302bc3469d7489:/src/osx/listbox_osx.cpp diff --git a/src/osx/listbox_osx.cpp b/src/osx/listbox_osx.cpp index e7194b1b99..c8a037b899 100644 --- a/src/osx/listbox_osx.cpp +++ b/src/osx/listbox_osx.cpp @@ -357,6 +357,14 @@ 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); + UpdateOldSelections(); return idx;