+1 vote

I have a chat app I'm building that has a MySQLi + PHP backend, using Godot for the frontend and I need to list all the users and make them clickable, which will open your chat with them. I can use an ItemList node but is there any way to make the items bigger on that?

By the way, I send a request to my server and it sends me back an array of the users, so I can use a for user in users type of thing for that part, I just need to know how I can either have larger items on an ItemList node, or if there's another way to do this.

Thanks in advance

Godot version Godot Engine 3.3.3 (Steam)
in Engine by (193 points)

1 Answer

0 votes
Best answer

I found the answer, I simply needed to do something like this:

for CHAT in CHATS:
    var BUTTON = Button.new()
    BUTTON.text = "Full Name - (Username)"


Here's the code I ended up using:

func _on_HTTPRequest_request_completed(_result, _response_code, _headers, body):
    var RESULT = body.get_string_from_utf8() #Data returned by backend

    var USERS = parse_json(RESULT) #parse from json

    for USER in USERS:
        var CHAT = Button.new() #Create a new button
        CHAT.text = USER[1] + " - (" + USER[0] + ")" #set the chat label text
        CHAT.connect("pressed", self, "_chat_pressed", [CHAT, USER[0], USER]) #connect the pressed to a function
        CHAT.rect_min_size.x = 250
        CHAT.rect_min_size.y = 35
        CHATS.add_child(CHAT) #add the button to the VBox Container
by (193 points)
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.