From: Vadim Zeitlin Date: Sat, 20 Apr 2013 22:13:33 +0000 (+0000) Subject: Add wxTextEntryDialog::SetMaxLength(). X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/62a58fbef55ae50b171f225f372ccfd0a4b251af Add wxTextEntryDialog::SetMaxLength(). Allow restricting the maximal number of characters that can be entered in wxTextEntryDialog. Closes #15158. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73832 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/docs/changes.txt b/docs/changes.txt index cffebeace9..4b80f44e18 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -629,6 +629,7 @@ All (GUI): - Add wxDocManager::FindDocumentByPath() (troelsk). - Add wxEVT_GRID_COL_AUTO_SIZE event (Igor Korot). - Add chainable wxWizardPageSimple::Chain() overload. +- Add wxTextEntryDialog::SetMaxLength() (derEine). wxGTK: diff --git a/include/wx/generic/textdlgg.h b/include/wx/generic/textdlgg.h index 2b78b8d9d7..bbd7c70de5 100644 --- a/include/wx/generic/textdlgg.h +++ b/include/wx/generic/textdlgg.h @@ -62,6 +62,8 @@ public: void SetValue(const wxString& val); wxString GetValue() const { return m_value; } + void SetMaxLength(unsigned long len); + #if wxUSE_VALIDATORS void SetTextValidator( const wxTextValidator& validator ); #if WXWIN_COMPATIBILITY_2_8 diff --git a/interface/wx/textdlg.h b/interface/wx/textdlg.h index 0a8bb93d7d..8e65e329c4 100644 --- a/interface/wx/textdlg.h +++ b/interface/wx/textdlg.h @@ -159,6 +159,16 @@ public: void SetTextValidator(wxTextValidatorStyle style = wxFILTER_NONE); //@} + /** + This function sets the maximum number of characters the user can enter + into this dialog. + + @see wxTextEntry::SetMaxLength() + + @since 2.9.5 + */ + void SetMaxLength(unsigned long len); + /** Sets the default text value. */ diff --git a/src/generic/textdlgg.cpp b/src/generic/textdlgg.cpp index 7d52947e51..03a5f690fc 100644 --- a/src/generic/textdlgg.cpp +++ b/src/generic/textdlgg.cpp @@ -151,6 +151,11 @@ void wxTextEntryDialog::OnOK(wxCommandEvent& WXUNUSED(event) ) } } +void wxTextEntryDialog::SetMaxLength(unsigned long len) +{ + m_textctrl->SetMaxLength(len); +} + void wxTextEntryDialog::SetValue(const wxString& val) { m_value = val;