I'm having a few issues making my own Panel, specially with a header. First, you can see that header (where lies the title "Start Game") has a very-very tiny horizontal line both left and right. Second, you can see that the button "Return" is overflowing on the panel border. Any tips? If necessary I can share the project...
#Padding overflow issues
14 messages · Page 1 of 1 (latest)
Is this a Panel or a PanelContainer - if it's a Panel you just give the child nodes a Margin, it's a basic control, they can handle how to offset themselves
if this is a PanelContainer you would want to look into putting a content_margin onto the stylebox so that the child nodes will offset automatically from the edges
With the Panel the children were overflowing the panel's border, so I had to use PanelContainer. Using MarginContainer was too ad-hoc as I had to deviate using pixels.
yes, these are design considerations
this doesn't have to be a PanelContainer if you make this Panel an expected size that is never smaller than its children
that just becomes a Panel with a Label and a VBoxContainer that's anchored within the Panel
if you don't add more than the Panel's size - you don't actually need the Container
this is just a matter of Anchoring and using appropriately sized nodes
doing this Automatically is just what you get out of a PanelContainer
it contains the nodes you throw in and sizes for you
if you know what's going to be inside already - it doesn't need to be more complicated than this - the only automatic part of this is the VBoxContainer - which could just be a few buttons anchored in place or positioned offset from the Panel
implementing this into a Container leaves it practically indistinguishable - all that's different is one extra node, and a few of stylebox settings
if this is a menu you'll be reusing a lot sure - the container makes sense
if this is just an opening menu box that's a one off or a very simple popup for a pause screen i wouldn't overthink it
Thanks a lot for the time! Actually I've experimented with VBoxContainer and it seems it's the only way to allow browsing focus between focusable controls like buttons in Godot though (I had used focus-lock these days in the web and it allows you to browse focusable elements in a different way, but... I guess VBoxContainer is pretty good for now). Also, it turns out that the expand margin of buttons still overflow; the title Label doesn't because it has no expand margin anymore. I guess all I can do is maybe increase the panel's expand margin, but I tried that and it broke the Label together.
don't use expand margin if you're trying to keep things in place - that is what causes overlap - because it draws outside the control node
use content_margin if you just want to give things extra space
Right, I'll see if I can make it work. It seems like my title label and my other button are conflicting
It works, indeed
Lemme see how my other buttons got
It didn't break anything too, apparently! Thanks a lot! At this case VBoxContainer is mostly handy because of the focus manager