Clearing a text field which has a float format?
Search
Clearing a text field which has a float format?
Anyone has any ideas on how to clear (ie. remove all shown text) a text field which is set to a float format? The usual textfield.text = ""; simply sticks a "0" in the textfield rather than wiping the contents. Format swap from float to string, then clear, then swap back to float also doesn't work as the textfield shows a "0" as soon as format goes back to float.
Re: Clearing a text field which has a float format?
what should be in the text field? Completely empty?
Re: Clearing a text field which has a float format?
Yes that was the plan, the idea is to clear it completely (ie. remove any numbers from it) after the user enters a number and clicks a button to process an action. Not even sure if this is possible with float format text fields tbh.
Re: Clearing a text field which has a float format?
This is not possible. The default value is always taken. For string the default value "" and for float 0.0 -> 0
Re: Clearing a text field which has a float format?
Hi there,
I think updating the format in KeyboardFocusIn/Out events might be helpful for you.
Keep your textbox format as string, update the format back to float when KeyboardFocusIn is triggered (when typing cursor appears).
When your action button is clicked, you can set the format back to string and value to empty string.
I think updating the format in KeyboardFocusIn/Out events might be helpful for you.
Keep your textbox format as string, update the format back to float when KeyboardFocusIn is triggered (when typing cursor appears).
When your action button is clicked, you can set the format back to string and value to empty string.
Re: Clearing a text field which has a float format?
Thanks ozangor!