Author Topic: Press Enter to Login in Passwordfield & Save username in unsername field  (Read 15412 times)

UltraTM

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 5
    • View Profile
Hi,

1. How can i make that when i have 2 Textinput fields one is Username and one is password. So when im in the password field i want to hit enter to also press the Login Button.
I attached an Keybinding to the Login Button. But it doesnt work when im in the input field. Always need to click somewhere else first that im able to press Enter for Login.


2. How can i save the username which is typed in. What i mean is that always the las text which was typed in the Username Textfield appears?
Would be nice to now cause im not really a programmer at all. Would be so nice if someone could help there :)

Thank you very much . And i love NGUI better then all other GUIs out there. Makes so much fun to work with it
« Last Edit: September 14, 2014, 01:50:29 AM by UltraTM »

UltraTM

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 5
    • View Profile
Re: 2 Questions about NGUI Stuff cause of Login and Username
« Reply #1 on: September 14, 2014, 01:49:54 AM »
Can someone please help me :(

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Press Enter to Login in Passwordfield & Save username in unsername field
« Reply #2 on: September 14, 2014, 03:35:43 AM »
1. You get an On Submit notification in input fields. Inside this callback do something -- such as clicking your button. You can choose this function right in inspector. Key bindings won't trigger from input fields. All key bindings are inactive while typing text in an input field.

2. It's done automatically if you specify a "Save As" value.

UltraTM

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 5
    • View Profile
Re: Press Enter to Login in Passwordfield & Save username in unsername field
« Reply #3 on: September 14, 2014, 03:50:26 AM »
1. Got it thanks now i understand that :)

2. What should i insert in Saved As or is there something else needed? This i dont understand right. I used Username but still nothing saved.
« Last Edit: September 14, 2014, 04:04:40 AM by UltraTM »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Press Enter to Login in Passwordfield & Save username in unsername field
« Reply #4 on: September 14, 2014, 04:38:08 AM »
It's a key that is used to save the value. If you use "Username" it will save it under that key. Note that it's the value of the input field that gets saved. So if you use "Username" as the "Save As" value, and type "Hello world" in the input field then hit Enter to submit it, the "Hello world" will get saved. Then if you stop the game and hit Play again, the input field's value will be automatically set to "Hello world" until you change it to something else.

UltraTM

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 5
    • View Profile
Re: Press Enter to Login in Passwordfield & Save username in unsername field
« Reply #5 on: September 14, 2014, 04:56:19 AM »
Seems good also played with notify password and all to save both.

But can i also make an remember me checkbox to save both only when this is checked?

that would be awesome if you could show me that :)
« Last Edit: September 14, 2014, 12:41:29 PM by UltraTM »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Press Enter to Login in Passwordfield & Save username in unsername field
« Reply #6 on: September 15, 2014, 04:05:20 AM »
In the checkbox's On Change notification, set the UIInput's "save as" value to either something, or nothing. If it's nothing, it won't save.