From 29759eb3857847beac6c5ce3a9048f5a3abc24c3 Mon Sep 17 00:00:00 2001 From: Charlie Fenton Date: Thu, 27 Aug 2015 01:30:19 -0700 Subject: [PATCH] MGR: in Simple View Preferences dialog, highlight textedit field with illegal value by setting its background to light red. --- clientgui/sg_DlgPreferences.cpp | 12 ++++++++++++ clientgui/sg_DlgPreferences.h | 3 +++ 2 files changed, 15 insertions(+) diff --git a/clientgui/sg_DlgPreferences.cpp b/clientgui/sg_DlgPreferences.cpp index 21353cc1b23..1f935b21a19 100644 --- a/clientgui/sg_DlgPreferences.cpp +++ b/clientgui/sg_DlgPreferences.cpp @@ -96,6 +96,8 @@ CPanelPreferences::~CPanelPreferences( ) bool CPanelPreferences::Create() { m_backgroundBitmap = NULL; + lastErrorCtrl = NULL; + stdTextBkgdColor = *wxWHITE; CreateControls(); @@ -846,6 +848,16 @@ void CPanelPreferences::ShowErrorMessage(wxString& message,wxTextCtrl* errorCtrl if(message.IsEmpty()){ message = _("invalid input value detected"); } + if (lastErrorCtrl) { + lastErrorCtrl->SetBackgroundColour(stdTextBkgdColor); + lastErrorCtrl->Refresh(); + } + if (lastErrorCtrl != errorCtrl) { + stdTextBkgdColor = errorCtrl->GetBackgroundColour(); + } + errorCtrl->SetBackgroundColour(wxColour(255, 192, 192)); + errorCtrl->Refresh(); + lastErrorCtrl = errorCtrl; wxGetApp().SafeMessageBox(message,_("Validation Error"),wxOK | wxCENTRE | wxICON_ERROR,this); errorCtrl->SetFocus(); } diff --git a/clientgui/sg_DlgPreferences.h b/clientgui/sg_DlgPreferences.h index 97805de0db8..5027d624649 100644 --- a/clientgui/sg_DlgPreferences.h +++ b/clientgui/sg_DlgPreferences.h @@ -174,6 +174,9 @@ class CPanelPreferences: public wxPanel wxBitmap* m_backgroundBitmap; bool m_bOKToShow; + + wxColour stdTextBkgdColor; + wxTextCtrl* lastErrorCtrl; ////@end CPanelPreferences member variables GLOBAL_PREFS global_preferences_working;