Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: StridingDragon on February 08, 2013, 02:09:18 AM

Title: UIInput text after losing focus
Post by: StridingDragon on February 08, 2013, 02:09:18 AM
Sadly UIInput does not generate an OnSubmit() event when it loses focus because the user clicked on a different button, even though it is technically equivalent to accepting the input. Is there some other event that I could use to capture this happening, so that the contents of the text field can be properly checked, manipulated and copied to wherever they need to go?
Title: Re: UIInput text after losing focus
Post by: ArenMook on February 08, 2013, 07:30:17 AM
Leaving the field does not mean submitting it. Hitting Enter is submitting it. If you want it to submit on lost focus, write a script that has OnSelect (bool selected) in it, and react to it.
Title: Re: UIInput text after losing focus
Post by: StridingDragon on February 08, 2013, 10:52:50 AM
I thought I tried that and never once received an OnSelect event, but I'll try again. Thanks for the tip.
Title: Re: UIInput text after losing focus
Post by: StridingDragon on February 08, 2013, 08:54:29 PM
Thanks a bunch, Aren. I got it to work with OnSelect, just as you suggested.
Title: Re: UIInput text after losing focus
Post by: StridingDragon on February 11, 2013, 09:13:14 PM
By the way, I just wanted to let you know that I disagree with your assessment that leaving a field is not the same as submitting. In my view - and I am sure in the view of most people, it most definitely is the same thing.
Title: Re: UIInput text after losing focus
Post by: Phoenix2518 on December 07, 2014, 12:39:39 PM
Almost two years later, I encountered the same issue. I have to agree with StridingDragon - losing focus should be considered submitting the text. After all, that's how every text box in the Unity editor works, for validation purposes.