The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates. | Twitter

+1 vote

I've been using ItemList, but it only takes one string of text and an optional icon. What I would like is to have two columns of text on the same line like in this image. See the Pick A Perk box with the text in green and yellow.

The name and numbers in () are the same selectable line, but they are in different columns that line up.

With the font I'm using if I put it all in the same line separated by spaces, the second column does not line up. Is there an alternative to ItemList that can have mutliple strings in the same item, or should I make a feature request?

in Engine by (251 points)

you can do this with Tree with set_hide_root(true)

1 Answer

+4 votes
Best answer

In the script of the ItemList node you must insert:


where MAXCOL is a constant for number of columns for a row.


by (1,488 points)
selected by

good to know :)

That doesn't work for what I need. It just makes different entries appear in different columns.

If you look at the picture, I want to separate the text inside an entry. The numbers in brackets aren't a separate entry, they are ranks for each entry.

What's the problem? You may use two different columns, but selectable together....
In the past I've made a Godot database application (SQlite) that used itemlist control with seven fields for a row.

Example of multicolumn Godot ItemList

So how did you make them selectable together?

It's simple. Put a signal "item_selected" on ItemList like this:

func _on_ItemList_item_selected( index ):
var i
index = int(index / MAXCOL) * MAXCOL 

# set background color for all fields in the row
for i in range (0, MAXCOL):
    self.set_item_custom_bg_color(index + i, Color (0, 0, 1))

Wow that's cool. Thank you!

I know this is an old thread, but I just wanted to also thank you - almost gave up using the ItemList because of it's lack of multi item columns. Your hack saved me a lot of time rolling my own solution.

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 Frequently asked questions and 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 [email protected] with your username.