Page 1 of 1

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

Posted: Sat Dec 28, 2019 1:25 am
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!