+1 vote

So, I'm currently trying to implement an inventory. I was able to add items to an inventory by creating a new Button and Label (to get the count of how many items of that kind there are) every time. I think using a VButtonArray would probably end up being better, considering I can get the index of the button and use that to track which item is being used by the player, plus it would make for less nodes created.

Either way, my main issue is having a scrollable list of items, without using a mouse.

There was another question asking about following focus with the ScrollContainer, but it used several children in a VBoxContainer. What I want is just one child, that being the VButtonArray (possibly more if I end up putting a few VButtonArrays in one HBoxContainer for columns).

Obviously I need to do this via script, but I can't fathom how to go about this. I was thinking of getting the index of the currently selected/focused button and using that to determine scrolling, but I just can't wrap my head around it right now. Does anyone have a solution?

in Engine by (13 points)
edited by

I've just been playing with it for a little while and it doesn't seem like there's a way to follow focus. There's no way to get an actual button from the button array. You might have to go with the VBox setup. Or check out ItemList and see if that'll work for you.

edit: Here's a link to help with scroll container and VBox: https://godotengine.org/qa/2199/how-to-make-a-list-with-a-scrolling-container

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.