Show changing the control colour when the validator fails.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15893 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -127,9 +127,14 @@ class TextObjectValidator(wxPyValidator):
|
|||||||
|
|
||||||
if len(text) == 0:
|
if len(text) == 0:
|
||||||
wxMessageBox("A text object must contain some text!", "Error")
|
wxMessageBox("A text object must contain some text!", "Error")
|
||||||
|
textCtrl.SetBackgroundColour("pink")
|
||||||
textCtrl.SetFocus()
|
textCtrl.SetFocus()
|
||||||
|
textCtrl.Refresh()
|
||||||
return false
|
return false
|
||||||
else:
|
else:
|
||||||
|
textCtrl.SetBackgroundColour(
|
||||||
|
wxSystemSettings_GetColour(wxSYS_COLOUR_WINDOW))
|
||||||
|
textCtrl.Refresh()
|
||||||
return true
|
return true
|
||||||
|
|
||||||
|
|
||||||
@@ -182,7 +187,9 @@ class TestValidateDialog(wxDialog):
|
|||||||
|
|
||||||
|
|
||||||
buttons = wxBoxSizer(wxHORIZONTAL)
|
buttons = wxBoxSizer(wxHORIZONTAL)
|
||||||
buttons.Add(wxButton(self, wxID_OK, "Okay"), 0, wxALL, 10)
|
b = wxButton(self, wxID_OK, "Okay")
|
||||||
|
b.SetDefault()
|
||||||
|
buttons.Add(b, 0, wxALL, 10)
|
||||||
buttons.Add(wxButton(self, wxID_CANCEL, "Cancel"), 0, wxALL, 10)
|
buttons.Add(wxButton(self, wxID_CANCEL, "Cancel"), 0, wxALL, 10)
|
||||||
|
|
||||||
border = wxBoxSizer(wxVERTICAL)
|
border = wxBoxSizer(wxVERTICAL)
|
||||||
|
Reference in New Issue
Block a user