Page 1 of 1
[posila][1.0.0] numeric or decimal textfield won't take - or . as initial input when selection would make it valid input
Posted: Fri Sep 04, 2020 2:12 am
by sparr
Code: Select all
tf = game.player.gui.center.add{type="textfield"}
tf.numeric = true
tf.allow_decimal = true
tf.text = 123.45
tf.select_all()
tf.focus()
Now if you press a number key it will overwrite the selected text, but if you press "-" or "." then it will do nothing. I think they are being rejected as input because "123.45." and "123.45-" are not valid values in the field, but "." should be allowed if the existing "." is selected to be overwritten, and "-" should be allowed if the selection includes the first character of the field.
Re: [1.0.0] numeric or decimal textfield won't take - or . as initial input when selection would make it valid input
Posted: Tue Sep 29, 2020 10:09 pm
by Honktown
There is also "allow_negative = true". '-' works as expected with select all and if the cursor is moved in front, but '.' won't work if one is already present. Replacing selected numbers (if the field doesn't have '.' already), moving the cursor anywhere, or having nothing present, the '.' can be typed.
Re: [posila][1.0.0] numeric or decimal textfield won't take - or . as initial input when selection would make it valid i
Posted: Wed Sep 30, 2020 9:11 pm
by posila
Thanks for the report.
Fixed for 1.1.0