Skip to content

Commit

Permalink
MGR: in Simple View Preferences dialog, highlight textedit field with…
Browse files Browse the repository at this point in the history
… illegal value by setting its background to light red.
  • Loading branch information
Charlie Fenton committed Aug 27, 2015
1 parent 6c28719 commit 29759eb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
12 changes: 12 additions & 0 deletions clientgui/sg_DlgPreferences.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ CPanelPreferences::~CPanelPreferences( )
bool CPanelPreferences::Create()
{
m_backgroundBitmap = NULL;
lastErrorCtrl = NULL;
stdTextBkgdColor = *wxWHITE;

CreateControls();

Expand Down Expand Up @@ -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();
}
Expand Down
3 changes: 3 additions & 0 deletions clientgui/sg_DlgPreferences.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 29759eb

Please sign in to comment.