Scroll-pane
Scroll-pane
Hi,
this new scroll-pane GUIelement is great ! No need to implement pages on lists anymore.
But would it be possible to read/write the vertical (and horizontal) position of the pane ?
Maybe like GUIelement.set_pane(vertical,horizontal) when vertical,horizontal are in [0,1] range ?
Because sometimes, when the user click something in the GUI, I want to show him a specific item of a big list which is in a scroll-pane.
Or sometimes, if you have to refresh/rebuild the inside of the scroll-pane, you want to reposition it at the same place than before, so that the user does not see the difference, otherwise the scrool-pane always come back to its 0 position...
this new scroll-pane GUIelement is great ! No need to implement pages on lists anymore.
But would it be possible to read/write the vertical (and horizontal) position of the pane ?
Maybe like GUIelement.set_pane(vertical,horizontal) when vertical,horizontal are in [0,1] range ?
Because sometimes, when the user click something in the GUI, I want to show him a specific item of a big list which is in a scroll-pane.
Or sometimes, if you have to refresh/rebuild the inside of the scroll-pane, you want to reposition it at the same place than before, so that the user does not see the difference, otherwise the scrool-pane always come back to its 0 position...
My mods on the Factorio Mod Portal ![Geek :geek:](./images/smilies/icon_e_geek.gif)
![Geek :geek:](./images/smilies/icon_e_geek.gif)
Re: Scroll-pane
I reup this thread.
I use these new scroll pane that are very handy, but I often need to read or write their position, when I need to recrate the list and position it at the same position than before. Or if I want to show the end of the list just after creating it.
I use these new scroll pane that are very handy, but I often need to read or write their position, when I need to recrate the list and position it at the same position than before. Or if I want to show the end of the list just after creating it.
My mods on the Factorio Mod Portal ![Geek :geek:](./images/smilies/icon_e_geek.gif)
![Geek :geek:](./images/smilies/icon_e_geek.gif)
Re: Scroll-pane
Scroll-pane!? It seems that something is missing on the API document.
I wonder if it can be used as a simple scrollbar when its position supports read/write (e.g. for the color picker
)
![Geek :geek:](./images/smilies/icon_e_geek.gif)
I wonder if it can be used as a simple scrollbar when its position supports read/write (e.g. for the color picker
![Laughing :lol:](./images/smilies/icon_lol.gif)
- aubergine18
- Smart Inserter
- Posts: 1264
- Joined: Fri Jul 22, 2016 8:51 pm
- Contact:
Re: Scroll-pane
I thought scrolling was done now using a frame with the scroll policy set as applicable?
Being able to read/write the scroll position on anything that scrolls is pretty vital requirement tho...
Being able to read/write the scroll position on anything that scrolls is pretty vital requirement tho...
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.
Re: Scroll-pane
The issue is the scroll position isn't saved anywhere and isn't part of the game state so there's no easy way to give read access to it that wouldn't cause desyncs.
I could probably add a method that does something like: "scroll_into_view(GUI element)" where it would scroll that specific item into view. Would that work?
I could probably add a method that does something like: "scroll_into_view(GUI element)" where it would scroll that specific item into view. Would that work?
If you want to get ahold of me I'm almost always on Discord.
Re: Scroll-pane
Yes. I could handle what I need with this feature.Rseding91 wrote:I could probably add a method that does something like: "scroll_into_view(GUI element)" where it would scroll that specific item into view. Would that work?
My mods on the Factorio Mod Portal ![Geek :geek:](./images/smilies/icon_e_geek.gif)
![Geek :geek:](./images/smilies/icon_e_geek.gif)
- aubergine18
- Smart Inserter
- Posts: 1264
- Joined: Fri Jul 22, 2016 8:51 pm
- Contact:
Re: Scroll-pane
an scrollingElement.is_in_view(guiElement) would also be useful - eg. to avoid doing updates on elements that aren't in view.
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.
Re: Scroll-pane
Again that has the same problem: widget positions aren't saved in the game file so it would lead to desyncs if that information was used incorrectly (which it almost always would be).aubergine18 wrote:an scrollingElement.is_in_view(guiElement) would also be useful - eg. to avoid doing updates on elements that aren't in view.
If you want to get ahold of me I'm almost always on Discord.
- aubergine18
- Smart Inserter
- Posts: 1264
- Joined: Fri Jul 22, 2016 8:51 pm
- Contact:
Re: Scroll-pane
Posting in correct topic this time:
Out of curiosity, why does the GUI get included in MP game state? Surely it's the actions that arise from the GUI (such as updating an element or item on the map, etc) that matter and not the front-end UI the user used to trigger those actions?
Out of curiosity, why does the GUI get included in MP game state? Surely it's the actions that arise from the GUI (such as updating an element or item on the map, etc) that matter and not the front-end UI the user used to trigger those actions?
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.
Re: Scroll-pane
As far as I understood, game desync is detected by comparing clients memory in a brute way.
And only user's control inputs (mouse clicks, keys) are transmitted to other clients.
Mod actions modifying GUI inplace of the user would not be transmitted to other clients, leading to desync.
And only user's control inputs (mouse clicks, keys) are transmitted to other clients.
Mod actions modifying GUI inplace of the user would not be transmitted to other clients, leading to desync.
My mods on the Factorio Mod Portal ![Geek :geek:](./images/smilies/icon_e_geek.gif)
![Geek :geek:](./images/smilies/icon_e_geek.gif)
Re: Scroll-pane
What about an on_gui_scrolled event?Rseding91 wrote:Again that has the same problem: widget positions aren't saved in the game file so it would lead to desyncs if that information was used incorrectly (which it almost always would be).aubergine18 wrote:an scrollingElement.is_in_view(guiElement) would also be useful - eg. to avoid doing updates on elements that aren't in view.
![Mr. Green :mrgreen:](./images/smilies/icon_mrgreen.gif)
I guess you know the scrollbar position when the player scrolled it? But don't know whether this will affect game performance.
Re: Scroll-pane
more likly a on_scrollbar_released(LuaGuiItem, position) event.
Re: Scroll-pane
They're thinking modders would be too stupid to use client sided gui + custom synchronization correctly, and force everyone on a more restrictive system so it can't be done wrong.aubergine18 wrote:Posting in correct topic this time:
Out of curiosity, why does the GUI get included in MP game state? Surely it's the actions that arise from the GUI (such as updating an element or item on the map, etc) that matter and not the front-end UI the user used to trigger those actions?
Re: Scroll-pane
If you look into the RGB value bars for changing locomotive color, the scrollbars can update the textfields whenever they are scrolled and before they are released.steinio wrote:more likly a on_scrollbar_released(LuaGuiItem, position) event.
But this can be the solution if the on scrolled event is causing trouble on game performance.
![Razz :P](./images/smilies/icon_razz.gif)
Re: Scroll-pane
I have implemented this for 0.17.19 (I have source access).
Includes: scoll_to_left, scroll_to_right, scroll_to_top, scroll_to_bottom, and scroll_to_element, and works for both scroll-panes and text-boxes.
If you think a scroll_to(x, y) would be useful, please make a new request topic for it.
Includes: scoll_to_left, scroll_to_right, scroll_to_top, scroll_to_bottom, and scroll_to_element, and works for both scroll-panes and text-boxes.
If you think a scroll_to(x, y) would be useful, please make a new request topic for it.