Probable display bug in number fields

I may have found the problem. And it’s probably my problem.

I wrap the TextBox in a custom component, so that I can explicitly set MIN and MAX values. I use the same component for both entry of both floats and ints.

As a safety net, just in case the SimpleObject had supplied the value as a non-number (e.g., due to a prior data conversion or format conversion), I have been casting the value to the more general form, float, just before entry. (No point in alarming the end-user for such a data problem; not when it has such an obvious fix.)

Until a few days ago, that was fine. A whole number, even if it was a float, would display with no decimal point or fraction. That seems to be what has changed.

Cast your integer values to float, in the Data Binding expression, and you’ll see the effect. “.0” will be appended to the value on display.

Whether this is universally desirable, may be a matter for discussion.

A float with no fraction will still save to SimpleObject as an integer (no fraction), so the difference in data type wasn’t visible in the database.

In case this bites someone else, it may be useful to add a flag to Number fields, to explicitly say “integer only”. Default: False.

In the meantime, since there now is a difference, it may help to document the difference.

For my own App, I’ll discuss, with my colleagues, what behavior we want to present to users, and alter my Custom Component accordingly. (Some of my fields, e.g., a person’s age, are clearly integer-only. For others, it’s much less clear.) This may mean adding an “integer only” flag, or hooks for data-conversion functions, where it makes sense.