Author Topic: Setting focus to UIInput by code on mobile  (Read 4633 times)

caiorosisca

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 10
    • View Profile
Setting focus to UIInput by code on mobile
« on: March 20, 2015, 09:05:17 AM »
Hi, first time posting here, I've looked around but couldn't find a solution to my case here.
I have a simple form where you need to fill in some info like name, age, etc...
What I want to happen is that when I press return on the touch screen keyboard on the mobile device it automatically focus the next field, so I don't have to touch on it to bring the keyboard up.
I have return key set to submit and I tried using nextField.isSelected = true, it works fine in the editor but nothing happens when on a mobile device. Any help?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Setting focus to UIInput by code on mobile
« Reply #1 on: March 22, 2015, 07:56:37 AM »
I believe you may need to wait a frame with mobiles... Which version of NGUI are you using? Post the code you're using, and try doing a yield return null;

caiorosisca

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 10
    • View Profile
Re: Setting focus to UIInput by code on mobile
« Reply #2 on: March 23, 2015, 02:23:47 PM »
That solved the problem, thanks