Add wxTextEntryDialog::ForceUpper()

Just forward it to wxTextCtrll::ForceUpper().

Closes #17291.
This commit is contained in:
mgimenez
2016-01-22 14:41:06 +01:00
committed by Vadim Zeitlin
parent 0fa1ddb368
commit 78b19e6811
4 changed files with 41 additions and 8 deletions

View File

@@ -92,6 +92,7 @@ All (GUI):
- Add wxAddRemoveCtrl.
- Add wxAppProgressIndicator for MSW (Chaobin Zhang) and OS X (Tobias Taschner).
- Add wxTextEntry::ForceUpper().
- Add wxTextEntryDialog::ForceUpper().
- Add wxEVT_MAGNIFY mouse event (Joost Nieuwenhuijse).
- Add wxProcess::Activate().
- Fix setting colours of labels in wxSlider.

View File

@@ -63,6 +63,8 @@ public:
void SetMaxLength(unsigned long len);
void ForceUpper();
#if wxUSE_VALIDATORS
void SetTextValidator( const wxTextValidator& validator );
#if WXWIN_COMPATIBILITY_2_8

View File

@@ -173,6 +173,20 @@ public:
*/
void SetValue(const wxString& value);
/**
Convert all text entered into the text control used by the dialog to upper case.
Call this method to ensure that all text entered into the text control
used by the dialog is converted on the fly to upper case. If the text
control is not empty, its existing contents is also converted to upper
case.
@see wxTextEntry::ForceUpper()
@since 3.1.0
*/
void ForceUpper();
/**
Shows the dialog, returning wxID_OK if the user pressed OK, and wxID_CANCEL
otherwise.

View File

@@ -130,14 +130,20 @@ bool wxTextEntryDialog::Create(wxWindow *parent,
bool wxTextEntryDialog::TransferDataToWindow()
{
m_textctrl->SetValue(m_value);
if ( m_textctrl )
{
m_textctrl->SetValue(m_value);
}
return wxDialog::TransferDataToWindow();
}
bool wxTextEntryDialog::TransferDataFromWindow()
{
m_value = m_textctrl->GetValue();
if ( m_textctrl )
{
m_value = m_textctrl->GetValue();
}
return wxDialog::TransferDataFromWindow();
}
@@ -152,9 +158,10 @@ void wxTextEntryDialog::OnOK(wxCommandEvent& WXUNUSED(event) )
void wxTextEntryDialog::SetMaxLength(unsigned long len)
{
wxCHECK_RET( m_textctrl, wxS("Must be created first") );
m_textctrl->SetMaxLength(len);
if ( m_textctrl )
{
m_textctrl->SetMaxLength(len);
}
}
void wxTextEntryDialog::SetValue(const wxString& val)
@@ -167,6 +174,14 @@ void wxTextEntryDialog::SetValue(const wxString& val)
}
}
void wxTextEntryDialog::ForceUpper()
{
if ( m_textctrl )
{
m_textctrl->ForceUpper();
}
}
#if wxUSE_VALIDATORS
#if WXWIN_COMPATIBILITY_2_8
@@ -183,9 +198,10 @@ void wxTextEntryDialog::SetTextValidator( wxTextValidatorStyle style )
void wxTextEntryDialog::SetTextValidator( const wxTextValidator& validator )
{
wxCHECK_RET( m_textctrl, wxS("Must be created first") );
m_textctrl->SetValidator( validator );
if ( m_textctrl )
{
m_textctrl->SetValidator( validator );
}
}
#endif // wxUSE_VALIDATORS