Skip to content

Commit

Permalink
Remove close button from modal dialogs
Browse files Browse the repository at this point in the history
A user reported that accidentally closing dialogs such as the Objectives editor
with the top-right close button can result in data loss, because the dialog
treats this as "Cancel" and does not prompt to save changes. Now the close
button is removed, so a user must explicitly choose to click one of the main
buttons at the bottom.

I don't know for sure whether the wxSYSTEM_MENU style is needed, but since it
was part of the wxDEFAULT_DIALOG_STYLE and I'm not in a position to test its
removal (it only has an effect on Windows according to the docs), it is left in
for now.
  • Loading branch information
Matthew Mott committed Feb 25, 2020
1 parent a6c3540 commit 8ee8e42
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libs/wxutil/dialog/DialogBase.cpp
Expand Up @@ -18,7 +18,7 @@ void DialogBase::_onDelete(wxCloseEvent& ev)
DialogBase::DialogBase(const std::string& title, wxWindow* parent)
: wxDialog(parent ? parent : GlobalMainFrame().getWxTopLevelWindow(),
wxID_ANY, title, wxDefaultPosition, wxDefaultSize,
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
wxCAPTION | wxSYSTEM_MENU | wxRESIZE_BORDER)
{
Connect(wxEVT_CLOSE_WINDOW, wxCloseEventHandler(DialogBase::_onDelete),
nullptr, this);
Expand Down

0 comments on commit 8ee8e42

Please sign in to comment.