[posila][1.0.0] numeric or decimal textfield won't take - or . as initial input when selection would make it valid input

This subforum contains all the issues which we already resolved.
Post Reply
sparr
Smart Inserter
Smart Inserter
Posts: 1327
Joined: Fri Feb 14, 2014 5:52 pm
Contact:

[posila][1.0.0] numeric or decimal textfield won't take - or . as initial input when selection would make it valid input

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

Honktown
Smart Inserter
Smart Inserter
Posts: 1025
Joined: Thu Oct 03, 2019 7:10 am
Contact:

Re: [1.0.0] numeric or decimal textfield won't take - or . as initial input when selection would make it valid input

Post 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.
I have mods! I guess!
Link

posila
Factorio Staff
Factorio Staff
Posts: 5202
Joined: Thu Jun 11, 2015 1:35 pm
Contact:

Re: [posila][1.0.0] numeric or decimal textfield won't take - or . as initial input when selection would make it valid i

Post by posila »

Thanks for the report.
Fixed for 1.1.0

Post Reply

Return to “Resolved Problems and Bugs”