Remember language selection position after changed
This commit is contained in:
parent
d4a9f1c5b5
commit
5b427d76c6
@ -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();
|
||||
|
@ -155,6 +155,9 @@ void OptionsScreenLanguage::eventCallback(Widget* widget, const std::string& nam
|
||||
else if (name == "language")
|
||||
{
|
||||
ListWidget* list_widget = getWidget<ListWidget>("language");
|
||||
irr::gui::CGUISTKListBox* box =
|
||||
list_widget->getIrrlichtElement<irr::gui::CGUISTKListBox>();
|
||||
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<ListWidget>("language");
|
||||
box = list_widget->getIrrlichtElement<irr::gui::CGUISTKListBox>();
|
||||
box->getScrollBar()->setPos(old_pos);
|
||||
// Update tips for new translation
|
||||
TipsManager::destroy();
|
||||
TipsManager::create();
|
||||
|
Loading…
Reference in New Issue
Block a user