Ignore hints on wxTE_PASSWORD controls when not supported natively

There is no way to show the hint without native support in a control with
wxTE_PASSWORD style, so simply ignore them completely in this case.

Closes #17078.
This commit is contained in:
Vadim Zeitlin
2016-06-28 14:40:52 +02:00
parent 967bdbf994
commit 3dc54df247
4 changed files with 10 additions and 0 deletions

View File

@@ -91,6 +91,7 @@ All (GUI):
- Add support for using markup in wxDataViewCtrl text items. - Add support for using markup in wxDataViewCtrl text items.
- Implement auto complete in generic wxSearchCtrl (Eric Jensen). - Implement auto complete in generic wxSearchCtrl (Eric Jensen).
- Fix preserving selection when changing selection mode in wxGrid (jonkraber). - Fix preserving selection when changing selection mode in wxGrid (jonkraber).
- Fix wxTextEntry::SetHint() with wxTE_PASSWORD in generic implementation.
wxGTK: wxGTK:

View File

@@ -484,6 +484,9 @@ public:
focus and wxEVT_TEXT events, you must call wxEvent::Skip() on them focus and wxEVT_TEXT events, you must call wxEvent::Skip() on them
so that the generic implementation works correctly. 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 @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 platforms, but only MSW and GTK+ 2 support them for multi-line text
controls, they are ignored for them under the other platforms. controls, they are ignored for them under the other platforms.

View File

@@ -1102,6 +1102,7 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h )
m_password = new MyTextCtrl( this, wxID_ANY, wxT(""), m_password = new MyTextCtrl( this, wxID_ANY, wxT(""),
wxPoint(10,50), wxSize(140,wxDefaultCoord), wxTE_PASSWORD ); wxPoint(10,50), wxSize(140,wxDefaultCoord), wxTE_PASSWORD );
m_password->SetHint("Don't use 12345 here");
m_limited = new MyTextCtrl(this, wxID_ANY, "", m_limited = new MyTextCtrl(this, wxID_ANY, "",
wxPoint(10, 90), wxDefaultSize); wxPoint(10, 90), wxDefaultSize);

View File

@@ -376,6 +376,11 @@ void wxTextEntryBase::ForceUpper()
bool wxTextEntryBase::SetHint(const wxString& hint) 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 ( !hint.empty() )
{ {
if ( !m_hintData ) if ( !m_hintData )