The selected characters, as if the user had clicked and dragged across them.
When the user enters the value (presses a button or presses enter) then you extract the value, but you can also set the selected character range to the entire field, so that if the user types again, it will remove the previous text.
The easiest way to do this is to check “Select All Text when Focused” and “Select All Text on Commit”
Also, what does “if I don’t set the text, it doesn’t work” – WHAT doesn’t work? You’re not telling us anything else your code is doing with these text boxes. Presumably you’re using the values in the boxes somewhere, but I don’t see them being forward from this commit hook where you already have the text, which would be the typical place where you’d call some user-defined event dispatcher to let the rest of your app know what’s going on.