LuaGuiElement (list-box) :: scroll_to_item(index)

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
Post Reply
User avatar
raiguard
Factorio Staff
Factorio Staff
Posts: 451
Joined: Wed Dec 13, 2017 8:29 pm
Contact:

LuaGuiElement (list-box) :: scroll_to_item(index)

Post by raiguard »

Hello. I would like to request that a scroll_to_item() function be added to the list-box LuaGuiElement. The reason for this is because in my Encyclopedia mod, users can navigate the interface using either the mouse or keyboard shortcuts. I'm using a list-box to manage the search results. As you can see, there is a problem:

Image

There is no way for me to keep the currently selected item in view when they're using keyboard shortcuts.

The only way to fix this without the addition of a scroll_to_item() function being added would be to recreate all of the list-box logic myself, using a scroll-pane and a bunch of buttons, then using scroll_to_element(). This would greatly increase the complexity of the GUI, and I would like to avoid it if at all possible.

Alternatively, the list-box logic could be updated so that it automatically keeps its selected item in view.

Thanks!
Don't forget, you're here forever.

Post Reply

Return to “Modding interface requests”