What's the right way to custom built-in AcceptDialog or Window?

I’ve figure it out somehow but I am not sure if it’s the right way or there’s a better way.

I’ve changed the default font size (to a bigger one) in my custom theme. I need to make the title bar of the dialog higher.

I override the title bar height and the style box of Window in my custom theme. But the default flat style box does not cover the title bar, so I changed expand_margin_top, so far so good:

image

But somehow the content of the AcceptDialog is not “inside” the window. Modifying the content margins makes no difference. I set the four corner radiuses but you cannot the bottom left and right corner cuz they’ve been covered by the content of the AcceptDialog.

Anyway I override the style box of AcceptDialog and set the content margins of it, as well as the other three expand margins of Window:

image

Looks okay but if I change the corner radiuses of the style box of AcceptDialog:

image

I don’t know why there’s a gray space between them.(I give it a big radius so you can see it more clearly).

I don’t know if there’s a better way to do this rather than creating my own accept dialog from a window.

The height of the title bar and the offset of the X button is hard-coded, which is really not good.

The AcceptDialog node inherits from the Window node which has the theme properties you want to modify. Here’s a list of theme properties you can change Window — Godot Engine (stable) documentation in English

For example here’s one with a different border and position of the close icon

image

1 Like

In the past I tried making Window — Godot Engine (stable) documentation in English work with my projects.

After that failed, I just changed everything to a panel node with a button…
Depending on your needs you may want to consider this as well…

1 Like

That’s straight forward enough but works. I’ll consider that in later projects I guess.

Customizing the default dialogs and window is really tricky if I don’t want to reinvent the wheels. They are just not that flexible.

1 Like

Yeah I’ve read those sections of the docs. I can do some customization with those properties but some just don’t work as expected. Thank you anyway.