0 votes

Are either of those things possible in the standard Godot itemlist? I want an invisible item which will be a pointer to the object which is populating the list. In this case it's a list of football players, their name will show in the listbox but I want to be able to refer back to the player, who is stored in an array of objects. I 'could' take the name and search through the list for him but there could be duplicated player names. So I either want to store a reference to the player or a pointer to his position in the array, but not have it visible.

For now, I'm creating another array which is a copy of the names in the listbox. So array[0] will be a pointer to the name at position 0. This works but seems a bit fiddly.

Also, is it possible to have different column widths in the itemlist? I realise that it probably isn't, but is there a way?

I'm thinking perhaps I could do this in a different control but I don't see a good alternative at the moment.

in Engine by (73 points)

1 Answer

+1 vote
Best answer

Regarding your first part of the question: That's what "set_item_metadata()" and "get_item_metadata()" are for:


Regarding the second part: I don't think it's possible to change the individual column widths.

by (1,694 points)
selected by

Thanks, didn't know about the metadata :)

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.