Hi. I’m looking into building an inventory system.
If we for simplicity imagine something like Minecraft.
You have a player inventory and you have a chest inventory.
I have a separate UI for each of them, and I want to be able to shift-click a stack of items between them.
How do I handle Focus for this?
(As far as I know, only one widget can have SetKeyboardFocus…)
Would that not make it so that I can’t shift-click from one of them?
You have a player inventory and you
have a chest inventory. I have a
separate UI for each of them
Put this in both:
Now the keyboard focus is wherever the mouse is.
Or, depending how you set things up - who processes the shift+click (inventory or item stack), have it in the item itself. This way, it’s the currently hovered item that intercepts shift & click.
The pertinent widget needs the isFocusable flag up, too.
Cheers. I will probably try to solve it on the item widget actually yes.
Because I plan to implement one abstract one and then several different ones with different options depending on the context of the inventory you are in. =)