Hey, do someone know how to get the position of a gui element within a ScrollingFrame when using UIListLayout?
I’m making a plugin (here it is), as you can see, it has a sidebar with different categories. When a user click on a category, I would like the scrollingFrame to scroll to the first block of the category selected.
Best way to do this that I can think of is to manually observe where the scroll frame should be positioned when click each button. Then you can create an attribute inside each button telling the location where the scroll frame should be. When the button is clicked, configure the CanvasPosition of the frame.
Thank you for your help!
I will use that if there is not any other solution, but are you sure that there is not any function that allow you scrolling to an object? It would be a lot easier because I have planned to update the elements on a database. If I do this, I will have to manually change each value each time I add an element…
I believe that if you add another section downwards, it will not really affect the position of the frame since it uses the offset, not the scale. Unless you switch the position between two sections that you already made, that then, you will have to configure it again.
yes, I will add sections between the other sections or add blocks to some sections, so that will affect the entire system… do you thing that if observe the position of the last item of the scrollingFrame and then divid this position by the count of items in total, I will get the offset used by one item? If yes, I will be able to calculate the offset position of the first item of each section each time the currentSection changes
Yes of course. If there is no really function that can help you with this (I’m also sad), then using math to calculate the position would be a really great idea, you can use for loop to count how many elements inside each section and do some math calculations from there.