manups4e / ScaleformUI

ScaleformUI is a GTA menu styled API made with custom Scaleforms to be lighter, faster and visually better
Other
139 stars 49 forks source link

Fix current index on UiMenu:Clear() #169

Closed Zedsku closed 1 year ago

Zedsku commented 1 year ago

Hello, During the development on a project using the ScaleformUi, we use a submenu that have an dynamic size in each open. One time the number of element is 500 an another 300 , ... , ... And to make it we use the UiMenu:Clear() to clear the submenu and fill it with the new elements/items. But with that I notice that if I open the submenu with 500 items and put my current selection to 499 and back to the main menu and reopen it with 300 elements, it's not working and got an error because the currentselection stayed at 499 and is not reset by the Clear() that is not logical so I add it to the Clear() feature for UiMenu. For me, when we do a clear, we want to put the whole content of the menu at the initial state that means no item, current selection to 1. So I considerate it as a bug.

Thank to considerate it to fix it, Zedsku

manups4e commented 1 year ago

oooh i didn't think about that!! it's rare to have dynamically built menus!!! thanks!! can you add fix to C# side too?

Zedsku commented 1 year ago

Yeah of course, It's done but look at it I'm not familar with C# but normally it's fine it's just transpostion of a line XD

manups4e commented 1 year ago

values in C# start with 0 😄

Zedsku commented 1 year ago

I goes to fast and don't think on the moment of the langage difference. It's true that is only lua things to start to 1. Definitly better C and C#, need to learn C# actually. Fixed !

manups4e commented 1 year ago

ahahahahaha that's great!! thanks!! merging now!