Hi,
I want to clear a textfield on focus.
Any examples?
Tried searching and haven’t found any clear answers.
Thanks in advance!
Oliver
Hi,
I want to clear a textfield on focus.
Any examples?
Tried searching and haven’t found any clear answers.
Thanks in advance!
Oliver
put in default text like ‘Enter Name’, and then when a user clicks on it test to see if it still says ‘Enter Name’ and if it does, clear the text?
I think that would work…
although how you’d get when a user clicks on the textfield. GUI.Changed might register a click on a textfield
I have run into a need to do this myself, and discovered that GUI.Changed does not get a click on textfield.
Anyone else have any ideas?
I’m thinking to just check if the Event.current. mouse button is clicked within the rect of my textfield. But this is for iOS, is there a way to get touch events through the Event class on iOS?
Hello techmage, I’ve the same problem …
Have you found a solution?
You can do it with something like that:
TextEditor t = TextEditor)GUIUtility.GetStateObject(typeof(TextEditor), GUIUtility.keyboardControl);
t.SelectAll();
t.Delete();
I haven’t test it!