Assert instead of crashing in wxTextEntry method if the associated window
hadn't been fully created yet.
Closes #13218.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67947
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
wxString wxTextEntry::DoGetValue() const
{
wxString wxTextEntry::DoGetValue() const
{
+ wxCHECK_MSG( GetTextPeer(), wxString(), "Must create the control first" );
+
return GetTextPeer()->GetStringValue() ;
}
void wxTextEntry::GetSelection(long* from, long* to) const
{
return GetTextPeer()->GetStringValue() ;
}
void wxTextEntry::GetSelection(long* from, long* to) const
{
+ wxCHECK_RET( GetTextPeer(), "Must create the control first" );
+
GetTextPeer()->GetSelection( from , to ) ;
}
GetTextPeer()->GetSelection( from , to ) ;
}
void wxTextEntry::Copy()
{
void wxTextEntry::Copy()
{
+ wxCHECK_RET( GetTextPeer(), "Must create the control first" );
+
if (CanCopy())
GetTextPeer()->Copy() ;
}
void wxTextEntry::Cut()
{
if (CanCopy())
GetTextPeer()->Copy() ;
}
void wxTextEntry::Cut()
{
+ wxCHECK_RET( GetTextPeer(), "Must create the control first" );
+
if (CanCut())
GetTextPeer()->Cut() ;
}
void wxTextEntry::Paste()
{
if (CanCut())
GetTextPeer()->Cut() ;
}
void wxTextEntry::Paste()
{
+ wxCHECK_RET( GetTextPeer(), "Must create the control first" );
+
if (CanPaste())
GetTextPeer()->Paste() ;
}
if (CanPaste())
GetTextPeer()->Paste() ;
}
if (!IsEditable())
return false;
if (!IsEditable())
return false;
+ wxCHECK_MSG( GetTextPeer(), false, "Must create the control first" );
+
return GetTextPeer()->CanPaste() ;
}
void wxTextEntry::SetEditable(bool editable)
{
return GetTextPeer()->CanPaste() ;
}
void wxTextEntry::SetEditable(bool editable)
{
- if ( editable != m_editable )
- {
- m_editable = editable ;
- GetTextPeer()->SetEditable( editable ) ;
- }
+ if ( editable == m_editable )
+ return;
+
+ m_editable = editable ;
+
+ wxCHECK_RET( GetTextPeer(), "Must create the control first" );
+ GetTextPeer()->SetEditable( editable ) ;
}
void wxTextEntry::SetInsertionPoint(long pos)
}
void wxTextEntry::SetInsertionPoint(long pos)
wxTextPos wxTextEntry::GetLastPosition() const
{
wxTextPos wxTextEntry::GetLastPosition() const
{
+ wxCHECK_MSG( GetTextPeer(), -1, "Must create the control first" );
+
return GetTextPeer()->GetLastPosition() ;
}
void wxTextEntry::Remove(long from, long to)
{
return GetTextPeer()->GetLastPosition() ;
}
void wxTextEntry::Remove(long from, long to)
{
+ wxCHECK_RET( GetTextPeer(), "Must create the control first" );
+
{
EventsSuppressor noevents(this);
GetTextPeer()->Remove( from , to );
{
EventsSuppressor noevents(this);
GetTextPeer()->Remove( from , to );
void wxTextEntry::SetSelection(long from, long to)
{
void wxTextEntry::SetSelection(long from, long to)
{
+ wxCHECK_RET( GetTextPeer(), "Must create the control first" );
+
GetTextPeer()->SetSelection( from , to ) ;
}
void wxTextEntry::WriteText(const wxString& str)
{
GetTextPeer()->SetSelection( from , to ) ;
}
void wxTextEntry::WriteText(const wxString& str)
{
+ wxCHECK_RET( GetTextPeer(), "Must create the control first" );
+
{
EventsSuppressor noevents(this);
GetTextPeer()->WriteText( str );
{
EventsSuppressor noevents(this);
GetTextPeer()->WriteText( str );
void wxTextEntry::Clear()
{
void wxTextEntry::Clear()
{
+ wxCHECK_RET( GetTextPeer(), "Must create the control first" );
+
{
EventsSuppressor noevents(this);
GetTextPeer()->Clear();
{
EventsSuppressor noevents(this);
GetTextPeer()->Clear();
void wxTextEntry::Undo()
{
void wxTextEntry::Undo()
{
+ wxCHECK_RET( GetTextPeer(), "Must create the control first" );
+
if (CanUndo())
GetTextPeer()->Undo() ;
}
void wxTextEntry::Redo()
{
if (CanUndo())
GetTextPeer()->Undo() ;
}
void wxTextEntry::Redo()
{
+ wxCHECK_RET( GetTextPeer(), "Must create the control first" );
+
if (CanRedo())
GetTextPeer()->Redo() ;
}
if (CanRedo())
GetTextPeer()->Redo() ;
}
if ( !IsEditable() )
return false ;
if ( !IsEditable() )
return false ;
+ wxCHECK_MSG( GetTextPeer(), false, "Must create the control first" );
+
return GetTextPeer()->CanUndo() ;
}
return GetTextPeer()->CanUndo() ;
}
if ( !IsEditable() )
return false ;
if ( !IsEditable() )
return false ;
+ wxCHECK_MSG( GetTextPeer(), false, "Must create the control first" );
+
return GetTextPeer()->CanRedo() ;
}
return GetTextPeer()->CanRedo() ;
}