Fixed old (MSW specific) focus issue:

Description of issue:
When for some parameter set a value which is out of rage or inaccurate and than click to another parameter,
receive a warning message dialog with description of a problem.
After closing of this Dialog any button on settings tab doesn't work for first click.
Looks like after dialog is closed Notebook page loses a focus.
Workaround:
Use self-created WarningDialog (inherited from the wxDialog) instead of wxMessageDialog
This commit is contained in:
YuSanka 2021-02-10 11:24:25 +01:00
parent ba95a93a68
commit 3c37aed2f8
3 changed files with 77 additions and 4 deletions

View file

@ -16,6 +16,7 @@
#include <wx/tokenzr.h>
#include <boost/algorithm/string/predicate.hpp>
#include "OG_CustomCtrl.hpp"
#include "MsgDialog.hpp"
#ifdef __WXOSX__
#define wxOSX true
@ -263,7 +264,8 @@ void Field::get_value_by_opt_type(wxString& str, const bool check_value/* = true
if (m_value.empty() || boost::any_cast<double>(m_value) != val) {
wxString msg_text = format_wxstr(_L("Input value is out of range\n"
"Are you sure that %s is a correct value and that you want to continue?"), str);
wxMessageDialog dialog(m_parent, msg_text, _L("Parameter validation") + ": " + m_opt_id, wxICON_WARNING | wxYES | wxNO);
// wxMessageDialog dialog(m_parent, msg_text, _L("Parameter validation") + ": " + m_opt_id, wxICON_WARNING | wxYES | wxNO);
WarningDialog dialog(m_parent, msg_text, _L("Parameter validation") + ": " + m_opt_id, wxYES | wxNO);
if (dialog.ShowModal() == wxID_NO) {
if (m_value.empty()) {
if (m_opt.min > val) val = m_opt.min;
@ -323,7 +325,8 @@ void Field::get_value_by_opt_type(wxString& str, const bool check_value/* = true
const wxString msg_text = from_u8((boost::format(_utf8(L("Do you mean %s%% instead of %s %s?\n"
"Select YES if you want to change this value to %s%%, \n"
"or NO if you are sure that %s %s is a correct value."))) % stVal % stVal % sidetext % stVal % stVal % sidetext).str());
wxMessageDialog dialog(m_parent, msg_text, _(L("Parameter validation")) + ": " + m_opt_id , wxICON_WARNING | wxYES | wxNO);
// wxMessageDialog dialog(m_parent, msg_text, _(L("Parameter validation")) + ": " + m_opt_id , wxICON_WARNING | wxYES | wxNO);
WarningDialog dialog(m_parent, msg_text, _L("Parameter validation") + ": " + m_opt_id, wxYES | wxNO);
if ((!infill_anchors || val > 100) && dialog.ShowModal() == wxID_YES) {
set_value(from_u8((boost::format("%s%%") % stVal).str()), false/*true*/);
str += "%%";
@ -370,8 +373,7 @@ void Field::get_value_by_opt_type(wxString& str, const bool check_value/* = true
if (!m_value.empty())
text_value = get_thumbnails_string(boost::any_cast<std::vector<Vec2d>>(m_value));
set_value(text_value, true);
show_error(m_parent, _L("Input value is out of range")
);
show_error(m_parent, _L("Input value is out of range"));
}
else if (invalid_val) {
wxString text_value;