diff --git a/docs/changes.txt b/docs/changes.txt index 049385d25e..27d14a2650 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -91,6 +91,7 @@ All (GUI): - Add support for using markup in wxDataViewCtrl text items. - Implement auto complete in generic wxSearchCtrl (Eric Jensen). - Fix preserving selection when changing selection mode in wxGrid (jonkraber). +- Fix wxTextEntry::SetHint() with wxTE_PASSWORD in generic implementation. wxGTK: diff --git a/interface/wx/textentry.h b/interface/wx/textentry.h index 20bb7e238f..618fde61d9 100644 --- a/interface/wx/textentry.h +++ b/interface/wx/textentry.h @@ -484,6 +484,9 @@ public: focus and wxEVT_TEXT events, you must call wxEvent::Skip() on them so that the generic implementation works correctly. + Another limitation is that hints are ignored for the controls with + @c wxTE_PASSWORD style. + @remarks Hints can be used for single line text controls under all platforms, but only MSW and GTK+ 2 support them for multi-line text controls, they are ignored for them under the other platforms. diff --git a/samples/text/text.cpp b/samples/text/text.cpp index fa48fd798d..5813d7c94a 100644 --- a/samples/text/text.cpp +++ b/samples/text/text.cpp @@ -1102,6 +1102,7 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) m_password = new MyTextCtrl( this, wxID_ANY, wxT(""), wxPoint(10,50), wxSize(140,wxDefaultCoord), wxTE_PASSWORD ); + m_password->SetHint("Don't use 12345 here"); m_limited = new MyTextCtrl(this, wxID_ANY, "", wxPoint(10, 90), wxDefaultSize); diff --git a/src/common/textentrycmn.cpp b/src/common/textentrycmn.cpp index 298eb408a4..642fb9bd04 100644 --- a/src/common/textentrycmn.cpp +++ b/src/common/textentrycmn.cpp @@ -376,6 +376,11 @@ void wxTextEntryBase::ForceUpper() bool wxTextEntryBase::SetHint(const wxString& hint) { + // Hint contents would be shown hidden in a password text entry anyhow, so + // we just can't support hints in this case. + if ( GetEditableWindow()->HasFlag(wxTE_PASSWORD) ) + return false; + if ( !hint.empty() ) { if ( !m_hintData )