Open me2beats opened 1 year ago
I think this is too game/app-specific to be done in an universal manner. In polished apps, close confirmation dialogs often need to have some kind of custom behavior such as listing files that have unsaved changes:
The ConfirmationDialog node already makes creating these dialogs fairly straightforward, so I don't see much point in adding more stuff to Window which is already a heavyweight class.
I think this is too game/app-specific to be done in an universal manner. In polished apps, close confirmation dialogs often need to have some kind of custom behavior such as listing files that have unsaved changes:
True but there are still many cases where you need to just ask to close. Godot itself often only asks if the user really want to close the window, for example the editor window
Describe the project you are working on
a plugin that uses
Window
nodesDescribe the problem or limitation you are having in your project
this is related to https://github.com/godotengine/godot-proposals/issues/6830 Sometimes when the user presses a Window close button, we want to popup a confirmation dialog like
do you really want to close the window?
. The problem is you have to create it every time yourself The idea is Window can have built-in logic to open such close confirmation dialog when neededDescribe the feature / enhancement and how it helps to overcome the problem or limitation
Adding
Window
's built-inclose confirmation
dialog logic would solve the problem and would save some time especially when prototyping UIs.Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
add
Window
boolean propertyshow close confirmation
orask then closing
(not a native speaker so the naming may be clearer). It isfalse
by default (this is how it works now)If it is
true
that it waits forclose_requested
signal and then close confirmation dialog is opened with title likeconfirm closing
This dialog has 2 buttons likeclose
andcancel
. If you presscancel
then this dialog is closes and the window does not close. Then you pressclose
then you confirm that the Window will be closed.Also maybe there should be some new signals like
close confirmation accepted
andclose confirmation cancelled
; properties likeclose_confirmation_title
,close_confirmation_text
,close_confirmation_accept_text
,close_confirmation_cancel_text
.The close confirmation dialog theming support also would be useful
Also I think it is better to create the close confirmation dialog each time when close_requested is emitted instead of having it as a child all the time, for performance reasons.
If this enhancement will not be used often, can it be worked around with a few lines of script?
It can but it is not so handy
Is there a reason why this should be core and not an add-on in the asset library?
A plugin can add custom node but again it is not so handy