Is it possible to modify an ItemList's size / content?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By wombatTurkey
:warning: Old Version Published before Godot 3 was released.

For example, I’m trying to create an ItemList that shows the players characters. These characters are going to be from a dynamically generated sprite, not an image (icon) so I need to modify the contents of each item.

I chose the ItemList node because it supports columns and rows (unless I can get vBox/Hbox working together, I’d choose that instead), but for now, the ItemList node works fine, except for one issue, I cannot modify the size of each item inside the itemlist.


	get_node("ItemList 2").add_item("", null, true)
	get_node("ItemList 2").set_item_text(x, "Hello \n \n\n\n turkey ")

And then:

var itemchildren = get_node("ItemList 2").get_children()

But it only returns a [[VScrollBar:643]].

Is it possible to somehow get the actual items inside the ItemList node? So I can modify their size/content?

hi wombatTurkey

like an inventory?

I did not understand the question you have, if you can explain maybe otherwise.

Aquiles | 2016-08-04 13:59

I’m in the same position. There’s no API for it and no documentation explaining how to do it, so I guess it’s just simply not possible. This is starting to be a recurring theme with Godot.

oskfo | 2019-04-27 09:45

get_node("ItemList 2").add_item("", null, true)
get_node("ItemList 2").set_item_text(x, "Hello \n \n\n\n turkey ")

Why two lines?
You also can do

get_node("ItemList 2").add_item("Hello \n \n\n\n turkey", null, true)

And what did you think, the “\n \n\n\n” in your item-text should do?

Drachenbauer | 2022-05-14 12:16