wxFloatProperty validation error Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
Victory
Earned some good credits
Earned some good credits
Posts: 115
Joined: Fri Mar 19, 2010 1:20 am

wxFloatProperty validation error

Post 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?

Thanks.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7459
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: wxFloatProperty validation error

Post by ONEEYEMAN »

Hi,
Which platform/compiler?
Do you see it in the propgrid sample?

Thank you.
Victory
Earned some good credits
Earned some good credits
Posts: 115
Joined: Fri Mar 19, 2010 1:20 am

Re: wxFloatProperty validation error

Post 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.
Post Reply