Itemlist, invisible items and different column widths.

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Farflame

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.

:bust_in_silhouette: Reply From: Thomas Karcher

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.

Thanks, didn’t know about the metadata :slight_smile:

Farflame | 2019-06-06 19:54