Hey Devs!! I am having some trouble with user inputs and UI…
Actually I am trying to navigate through an inventory list using the mouse wheel…
The Inventory opens when I press the key and closes when released…
I am Toggling this from the Controller. Now I am guessing that in order to traverse through the items in the inventory, I need to set the focus to one of the items.
However, when I try to do so, the Input event method triggers the Completed event… and this is where I am stuck at so basically, I dont want to trigger that even if the user focus changes.
So it works something like:
Tab to Open the inventory → select an item from the list by traversing through with the mouse wheel → release the key
Now I am guessing that in order to traverse through the items in the inventory, I need to set the focus to one of the items.
This seems strange and probably requires some more thought. What will setting the focus on a widget respresenting an inventory slot achieve? Will it then take input and scroll to the next one? How does it know what the next one is? If it indeed does know, is that really sensible?
While a parent widget containing all the slots might make more sense, ultimately the character needs to know what it is currently holding.
Your in-game widgets (including the ‘parent’ widget for the whole inv) would ideally not be involved in any of this (and in this particular case, is actually possible), they would just reflect the current state of the inventory.
So you would show the inventory when your input action starts, and then subsequent mouse wheel events would change the ‘selected inventory slot’ on the character (or in a component on the character). The widget for a slot would have a binding that checks this inventory to see if it represents the currently selected slot and change the colour of it’s border or somesuch to indicate it is selected (or it would tap custom events generated when changing the selected slot, if you subscribe to the theory that UI is worth optimising).
This is slightly different behaviour than you describe, as it will change the selected item as you scroll, not sure if that is a big deal to you or not, but hopefully you have some ideas to play with now. Let us know how you go / if you have problems
Hey there… I have tried this and this works like a charm. I realized that even if I managed to get the focus system work correctly, it was gonna be difficult to actually click that button and execute the things that were linked to it.