|Topic was automatically imported from the old Question2Answer platform.
This is apparently harder than it might seem at first. This repo has my current attempt – obviously there’s something obvious I’m missing, but I can’t quite figure out how the margins interact with the various containers.
Cut and paste from the README.md:
- Box remains at fixed width
- Text can be arbitrarily long (within reason; not pasting the text of Moby Dick in there)
- InfoBox resizes itself to accommodate longer text
- InfoBox has a colored background
- Text is set away from edges of the box by margins.
1-3 are accomplished by putting the label inside a VBoxContainer. Alas, VBoxContainers cannot themselves be styled, so I put it inside of a PanelContainer to give the colored background, satisfying 4.
Number 5 is where I run into problems. I cannot figure out the logic of what margins are allowed to be set and which are fixed. If I try to change the margins on the VBoxContainer, they snap back. At one point I had the margins set up properly but they went back to zero once the text changed. (I can’t reproduce this at the moment.)