diff --git a/src/guiengine/widgets/CGUISTKListBox.hpp b/src/guiengine/widgets/CGUISTKListBox.hpp index 7eaa147a8..5e98a022f 100644 --- a/src/guiengine/widgets/CGUISTKListBox.hpp +++ b/src/guiengine/widgets/CGUISTKListBox.hpp @@ -171,6 +171,7 @@ namespace irr virtual void setDrawBackground(bool draw); void setAlternatingDarkness(bool val) { m_alternating_darkness = val; } + gui::IGUIScrollBar* getScrollBar() const { return ScrollBar; } private: void recalculateItemHeight(); diff --git a/src/states_screens/options/options_screen_language.cpp b/src/states_screens/options/options_screen_language.cpp index c2c5a0f89..067cc3514 100644 --- a/src/states_screens/options/options_screen_language.cpp +++ b/src/states_screens/options/options_screen_language.cpp @@ -155,6 +155,9 @@ void OptionsScreenLanguage::eventCallback(Widget* widget, const std::string& nam else if (name == "language") { ListWidget* list_widget = getWidget("language"); + irr::gui::CGUISTKListBox* box = + list_widget->getIrrlichtElement(); + int old_pos = box->getScrollBar()->getPos(); std::string selection = list_widget->getSelectionInternalName(); delete translations; @@ -190,6 +193,11 @@ void OptionsScreenLanguage::eventCallback(Widget* widget, const std::string& nam user_config->saveConfig(); OptionsScreenLanguage::getInstance()->push(); + // Menu is deleted so we need a new screen instance + OptionsScreenLanguage* os = OptionsScreenLanguage::getInstance(); + list_widget = os->getWidget("language"); + box = list_widget->getIrrlichtElement(); + box->getScrollBar()->setPos(old_pos); // Update tips for new translation TipsManager::destroy(); TipsManager::create();