Im trying to make a custom ui element,i set the size of its scene parent that is a control to the size i want with a gdscript but it doesnt affect the possition of it in the container
this is the custom element tree
the element and its control “Connector” set to the text size
how they are behaving in a vertical container, i have both of the control selected so you can see the area
You may be re-inventing the wheel here, mixing Node2D and Control nodes gets messy quickly but I think you want a HBoxContainer as the scene’s root node (so it’s size is relative to it’s children, where the Control root is not), Use a TextureRect instead of a sprite, or I suppose a button depending on what you are trying to do with that Area2D.
For the VBox, check Theme Overrides->Constants->Separation in the inspector panel.
@gertkeno i need the sphere thing to be “outside” of the bound box and it will have a collision with the mouse, not just a button, im using ui elemnt because i the behaviour is the same
i want to get this result, could code but i want to use the ui to automatically do it
@hexgrid it works when i override but not for the x axis, just y axis , am i doing something wrong to need to manually edit that theme constant ? this is the first time that i need to edit that
I think having a child that isn’t a control can cause hilarity like this to ensue; I’ve had this problem too.
If you don’t want to use the GraphEdit/GraphNode type then you can still make use of Control nodes. They have drag/drop mouse/over functionality. To show outside the container you may need to set some expand margins.
Regardless if you change your root node type to HBoxContainer, or even just set the Label as the root that should accurately give it’s size to the parent VBoxContainer.
@hexgrid i need the area2D,
@gertkeno the label as the root object is a good idea, im going to try that, but i will dig up more because the container to taking the control area into account bugs me
I’ll be interested to see what you come up with; I’ve got some hacks in my project working around this kind of thing.
i got another bug with the label size, should i make another post or share here ?
the label size is not changing if the text get smalled than before, also, i didnt know what graphNode did, im going to check it out @gertkeno