Author Topic: UIinput can only find onsubmit in the gui  (Read 6676 times)

MrCox

  • Guest
UIinput can only find onsubmit in the gui
« on: December 19, 2013, 01:09:58 AM »
Hi, is it a way to show onchange in the editor for the UIInput or is onchange only available if you write code to use it?
If it is not implemented yet but will be implemented later is there an eta for it?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIinput can only find onsubmit in the gui
« Reply #1 on: December 19, 2013, 12:03:17 PM »
It's a code-only feature as I don't see a use-case where it would be useful to have it be specified at edit time. What would you use it for?

MrCox

  • Guest
Re: UIinput can only find onsubmit in the gui
« Reply #2 on: December 20, 2013, 04:54:05 AM »
Hi, i would use it when i put a scrollview into my scene and to get a callback for everytime the user centers a item. But i added a uibutton script to each items instead and when the users presses the item so it's centered i get a callback onclick on the item instead.

But it would be nice to have a onCenterChange or something for the scrollview when the user drag a new item to the center.

Kind regards
Kenneth

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIinput can only find onsubmit in the gui
« Reply #3 on: December 20, 2013, 11:44:02 AM »
What does UIInput have to do with centering items in a scroll view?

MrCox

  • Guest
Re: UIinput can only find onsubmit in the gui
« Reply #4 on: December 20, 2013, 01:45:49 PM »
Sorry my fault, the scrollview confusion is another question but i just got confused and for keeping this post clean i will make another post for that question:)

The UIInput onchange i use for a login form, and for each change on the text i want to store the username into playerprefs.
OnSubmit will only work if the player presses enter on the Input after changing the text, but if the user uses the mouse and set focus to the field and then writes some text and then use the mouse to click on the password field the OnSubmit is not triggered.
I solved it by using code, but i prefer to set gui events in the editor.

Kind regards
Kenneth

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIinput can only find onsubmit in the gui
« Reply #5 on: December 21, 2013, 02:37:35 AM »
You can always have a script that listens to OnSelect(false) on the input field and saves the value then.
« Last Edit: December 21, 2013, 01:23:50 PM by ArenMook »

MrCox

  • Guest
Re: UIinput can only find onsubmit in the gui
« Reply #6 on: December 21, 2013, 07:09:33 AM »
Sorry for the confusion but please forget the scrollview, it's about the UIInput.

What i miss is a onChange notify in the editor for UIInput.
I use onchange for the username input on my login form, and for everytime the text change in the UIInput i save the value into userprefs.

The problem i have with onSubmit is that if the user uses the mouse and click on the UIInput and writes a username, then use the mouse to click outside of the username UIInput the onSubmit is never triggered.

I solved it by using onChange by code, but i would be really happy if the onChange could be implemented in the editor too since i prefer to set events in the editor not by code :)

Kind regards
Kenneth

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIinput can only find onsubmit in the gui
« Reply #7 on: December 21, 2013, 01:25:04 PM »
Sorry, I meant input field, not scroll view. Now it was I who got confused, but only when typing :P

All elements get OnSelect(true) when they get focus, which is when the input field adds a caret char and lets you type. When you click on another element, OnSelect(false) happens. So just have your script listen for OnSelect(false) and react accordingly.

yevdokia

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 5
    • View Profile
Re: UIinput can only find onsubmit in the gui
« Reply #8 on: March 05, 2014, 01:00:17 PM »
Actually, I'm also wondering if OnChange can be exposed in the editor. I have a vertical list of UIInput objects, and I want to reposition them as the user types, so that the text never overlaps. It seems like exposing OnChange would make this really easy. Is there a reason not to? Is there another way of handling this that you recommend?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIinput can only find onsubmit in the gui
« Reply #9 on: March 06, 2014, 11:32:26 AM »
It has already been exposed in 3.5.3.

yevdokia

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 5
    • View Profile
Re: UIinput can only find onsubmit in the gui
« Reply #10 on: March 10, 2014, 10:08:26 AM »
Oh, thanks!