#Adjusting Chatbox Background

1 messages · Page 1 of 1 (latest)

full fractal
#

Here's a video of what my current chatbox/consolebox looks and acts like.

I'd like it so the background panel (the dark rectangle behind the chat) actually moves dynamically with the amount of stuff in the chat: so instead of being this large all the time, it scales based on whats there

#

I'm not sure how to actually approach doing something like this, any ideas?
Currently, the chatbox_container (vbox) is what holds text entries, its set to display them from bottom up.

Would i have to adjust its size dynamically? how would i even know what size to set to- i cant just make it bigger/smaller based on the number of messages in chat because some can take up multiple lines 🤔

dull lodge
#

(i think) if you make the panel a child of the container it'll scale automatically? not sure tho

thorny abyss
#

Simple question... Why do you want to scale dynamically?

#

What do you get out of it?

dull lodge
#

there not being a huge empty void

#

of text box

thorny abyss
#

I think he wants to resize dynamically the chatbox(the place where there are all the messages

dull lodge
#

yea i know

thorny abyss
#

But simply why? Just keep it as large as the panel

dull lodge
#

cus it ugly

thorny abyss
#

Ok i i think i've got it, my bad i've misunderstood

#

Give me 30 minutes and i'll show you how to do it

full fractal
#

yeah, basically want it to be like the bottom 2
instead of how it currently is (top 2)- uses a load of extra space

dull lodge
#

ok isee what you've got there

#

basically you have the margin container a child of the panel

#

while the panel and the vbox should be the children of the margin container

thorny abyss
#

I've made a video 3 seconds and i'll send it here

#

sorry for bad audio i'm in vacation and have no microphone

#

basically what you do is resize the main panel to be 20(or whatever pixel height you choose for the text to be) higher

#

you can change the pixel height of the text based on the screen height / 30 to get a bigger text based on bigger screens, you can customize this method a lot

#

tell me if it fixes your problem and sorry for being rude before

thorny abyss
# thorny abyss

You can also change the origin of the panel so you have no problem of changin the position

full fractal
#

i mean yeah i can adjust the textbox size and position whenever a message is sent, but not all messages are the same size vertically, and messages can be deleted to (2 lines takes up more space and i'm unsure if theres any way to have the computer know if theres 2 lines or 1 line being taken up.)

Rn im trying to use the func _on_chatbox_container_resized(): signal
and adjusting the size whenever this is called by grabbing the sizes of all messages inside it

thorny abyss
#

If that's your concern you can just use the get_line_count method of text_edit