Don't set maximum text length for non-text wxPG properties
Setting the limit for the length of the text the user can enter in the text editor makes sense only for properties having text editors so in wxPGProperty::SetMaxLength() should be done a check whether to actually set a limit or not depending on the kind of editor used. wxPropertyGridInterface::SetPropertyMaxLength() should be implemented on top of wxPGProperty::SetMaxLength() to proceed only if maximum length was actually set.
This commit is contained in:
@@ -2001,7 +2001,13 @@ inline void wxPGProperty::SetEditor( const wxString& editorName )
|
||||
|
||||
inline bool wxPGProperty::SetMaxLength( int maxLen )
|
||||
{
|
||||
return GetGrid()->SetPropertyMaxLength(this,maxLen);
|
||||
const wxPGEditor* editorClass = GetEditorClass();
|
||||
if ( editorClass != wxPGEditor_TextCtrl &&
|
||||
editorClass != wxPGEditor_TextCtrlAndButton )
|
||||
return false;
|
||||
|
||||
m_maxLen = wxMax(maxLen, 0); // shouldn't be a nagative value
|
||||
return true;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
Reference in New Issue
Block a user