Text from label keeps going outside the Margin Container
Asked Answered
A

7

0

I've been working on a simple dialogue system with a very basic Ren'py like window. My issue right now is that my text from my label is going outside of the margin. Am I using the wrong node, or am I not using it right?



Actinometer answered 2/10, 2023 at 21:54 Comment(0)
S
0

Actinometer I'm not an expert on margin or container nodes, but I do know this:

  1. click the Label on the scene tree
  2. look at the Inspector panel on your right, and there should be an autowrap_mode property, a bit below the text box.
  3. set it to whatever looks right to you. assuming you have the layout of your Label correct, it should look good.
  4. celebrate.
Songful answered 3/10, 2023 at 0:5 Comment(0)
A
0

Songful I've tried the other options but I get funky results from it. Is this some kind of bug or a configuration issue?
I notice my margin container gets enlarged by the child label node.

I am using 4.1.1 of Godot
.

Actinometer answered 3/10, 2023 at 0:15 Comment(0)
S
1

the enlargement, i believe, is intended function.
what effect are you looking for from the label inside the margin?

my next response is gonna take a while. blame american public transit and my hunger for jelly beans.
in the meantime, maybe someone smarter than me might show up.

Songful answered 3/10, 2023 at 0:33 Comment(0)
A
0

Songful Trying to use label for dialogue text. Nothing fancy or complex. Something similar to what you're seeing here from Ren'py. But without the Renpy buttons such as rollback, skip text, history, etc.

In the first thread image, you can see the text leaving the margin on the right which is not what I wanted.

Actinometer answered 3/10, 2023 at 0:42 Comment(0)
S
0

Actinometer you're lucky. i missed the bus
if that's all you need, then it seems like a matter of messing with the Label's layout until it looks right.
as i said, I'm not familiar with margin or container nodes, i just use the anchors and call it good.
i'm about to miss the next bus, so look around the internet for some guides on how control node layouts work. i'm sure you're get the hang of it with enough experimentation, or as i said before, wait for someone smarter than me to show up.

Songful answered 3/10, 2023 at 0:52 Comment(0)
G
1

There is a clip_contents flag under the control/rect section that should stop overspilling. But it actually doesn't look like this is what you want. Seems you have a layout problem.

This can be tricky business. Here are a few points to consider (based on the screenshots you showed):

  • You are using manual layout. This is unnecessarily inflexible and complicated. I suggest using layout containers instead (VBoxContainer, MarginContainer and so on).
  • You are using plain labels. Are you absolutely confident that the main text will always fit into the window? If not I suggest to switch to RichTextLabel, because that one comes with its own scrollbars.
  • If you do want to stick with manual layout, check the size of your controls. Particularly the last two screenshots show a label with 0 width. That obviously can not work.
Gamone answered 3/10, 2023 at 6:10 Comment(0)
A
0

Gamone I've changed both labels to rich text labels and that seemed to do the trick. The root node and 2 other nodes are MarginContainers. It's just that the root node does not show icon for it.


Actinometer answered 3/10, 2023 at 6:51 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.