Page 1 of 1

wxFloatProperty validation error

Posted: Fri Feb 14, 2020 11:30 am
by Victory
After changing to 3.1.3 version of wxWidgets, I am seeing a property grid validation error that was not happening with earlier version. Specifically, I have a float64 property for which the code sets the min/max values using the following lines:

Code: Select all

mpPG->SetPropertyAttribute(pProp, wxPG_ATTR_MIN, ConvertToVariant(0.001));
mpPG->SetPropertyAttribute(pProp, wxPG_ATTR_MAX, ConvertToVariant(1000.0));
where mpPG is a pointer to wxPropertyGrid object and pProp is a pointer to wxFloatProperty object.

Here, any value in the 0.001 to 1000.0 should be valid. But, the property grid displays an error message saying the "Value must be between 1 and 1." even the value is set to something valid such as 50.

As I mentioned earlier, this used to work right in earlier version of wxWidgets.
Any idea about the cause/fix?


Re: wxFloatProperty validation error

Posted: Fri Feb 14, 2020 4:34 pm
Which platform/compiler?
Do you see it in the propgrid sample?

Thank you.

Re: wxFloatProperty validation error

Posted: Sat Feb 15, 2020 4:04 am
by Victory
Debugged the issue and fixed it.

During the validation, the property grid code in 3.1.3 version of wxWidgets calls GetRoundedValue<T>, which in turn calls ValueToString method of the property with argFlags set to wxPG_FULL_VALUE. Our code wasn't paying attention to the argFlags and instead was always returning the display string. Modifying our code to return the full value string when wxPG_FULL_VALUE flag is set fixed the issue.
In short, it was a shortcoming in our code that got exposed with the update of wxWidgets to 3.1.3.