How can i disable Buttons in a ConfirmationDialog I have added myself?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By MaaaxiKing

I have a ConfirmationDialog and want its buttons to be disabled.
I was able to do it for the ok button but not for something else (because I don’t have any cancel button, this would be the same like the ok). It worked like this:

$ConfirmationDialog.get_ok().disabled = true

I added a button with:
$ConfirmationDialog.add_button(“a”, false, “b”)

But I don’t know how I can get access to them.

:bust_in_silhouette: Reply From: njamster

The method add_button returns the created button. Save it to a variable and keep that variable around, if you want to still access it later on:

var button_a = $ConfirmationDialog.add_button("a", false, "b")
button_a.disabled = true

Oh right, that would be an easy option. Thanks a lot. But is it possible to do it without a variable too?

MaaaxiKing | 2020-04-12 16:36

But is it possible to do it without a variable too?

No. Not without modifying Godot’s source code at least.

njamster | 2020-04-12 16:45