Is there anyway to clear editable textbox after something has been typed in it?

Hello, I’ve ran into a problem, where if I type in any amount to editable textbox and then press enter and press the “button” it works fine, but after I type in another number without closing widget, and not pressing enter, it would remember the old amount and would display the old number and not the new one. Is there anyway to fix this issue? Thanks!

I also now that its caused by me setting the variable, but if I don’t set it the the function does not work.

Try setting the selection to all, such that the next character typed will remove the old value and start the new value.

Hello and thanks for response. What exactly to you mean selection?

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”

image

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.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.