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:
Artur Wieczorek
2019-05-26 00:39:48 +02:00
parent e45c6b0dd1
commit 7a29f5dd2c
5 changed files with 46 additions and 18 deletions

View File

@@ -1053,7 +1053,19 @@ public:
void SetPropertyImage( wxPGPropArg id, wxBitmap& bmp );
/**
Sets max length of property's text.
Sets maximum length of text in property text editor.
@param id
Property name or pointer.
@param maxLen
Maximum number of characters of the text the user can enter in
the text editor. If it is 0, the length is not limited and the text
can be as long as it is supported by the the underlying native text
control widget.
@return
Returns @true if maximum length was set.
@see
wxPGProperty::SetMaxLength.
*/
bool SetPropertyMaxLength( wxPGPropArg id, int maxLen );