[1.1.74] List-box not scrolling to index while in "on_configuration_changed"
Posted: Thu Jan 26, 2023 10:32 am
When creating a "list-box" gui element in the "script.on_configuration_changed" event this list-box cannot be scrolled (scroll_to_item) in the same event.
Obligatory expected result: The "list-box" gui element should scroll to the requested index
I did not test if this applies to more circumstances than that. (Meaning stuff like: "Can the list-box be created earlier?" or "Can the list-box scroll if there is enough time in between list-box creation and scroll_to_item" )
Here is a small mod that shows this bug in action (Note: You need to load a save that did not contain this mod before in order to trigger the "script.on_configuration_changed" event)
If this mod created the gui you should see two chat messages and a "list-box" gui element in the top left like this:
Obligatory expected result: The "list-box" gui element should scroll to the requested index
I did not test if this applies to more circumstances than that. (Meaning stuff like: "Can the list-box be created earlier?" or "Can the list-box scroll if there is enough time in between list-box creation and scroll_to_item" )
Here is a small mod that shows this bug in action (Note: You need to load a save that did not contain this mod before in order to trigger the "script.on_configuration_changed" event)
If this mod created the gui you should see two chat messages and a "list-box" gui element in the top left like this: