Author Topic: UIInput  (Read 60907 times)

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,154
  • Toronto, Canada
    • View Profile
Re: UIInput
« Reply #45 on: March 21, 2014, 04:15:37 PM »
The shrinking is intentional, thats what should happen when the text exceeds the bounds. Those are the two types of input supported -- either it's clamped and single line, or it's multi-line but automatically shrinks when the content exceeds the bounds.

pretender

  • Full Member
  • ***
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 155
    • View Profile
Re: UIInput
« Reply #46 on: April 01, 2014, 04:52:36 AM »
How "Saved As" is used? Can you help me?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,154
  • Toronto, Canada
    • View Profile
Re: UIInput
« Reply #47 on: April 01, 2014, 10:56:40 AM »
"Saved As" is currently bugged in 3.5.5. From the patch notes of 3.5.6:
Quote
- FIX: UIInput will now load the saved value properly even if the "starting value" is not empty.

pretender

  • Full Member
  • ***
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 155
    • View Profile
Re: UIInput
« Reply #48 on: April 01, 2014, 11:20:10 AM »
Is it read from player prefs? Or i am missing something. Cant wait for next release

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,154
  • Toronto, Canada
    • View Profile
Re: UIInput
« Reply #49 on: April 03, 2014, 09:55:53 PM »
I don't remember what the issue was... I just know there was an issue and it got fixed. :P

gonzosan

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 4
    • View Profile
Re: UIInput
« Reply #50 on: April 06, 2014, 02:46:52 PM »
Hello,

I just got NGUI a few days ago and I'm trying to use the input boxes so that a user can input a number then output it into the chat area I've designated. I've figured out how to do all that with just numbers (it tracks number values). The thing I'm having an issue with is how I can have it update every time a number is put in. What I'd like to do is have the numbers add up every time a new number is put in. I'm not sure how to go about this. I'm familiar with adding and subtracting integers in a script but not sure how to get the output to add up to a total that is constantly changing. For context I'm trying to build a health app, so users would keep track of calories throughout the day. They'd input calories for every meal and the total would update to reflect the new total. Any help is greatly appreciated.

gonzosan

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 4
    • View Profile
Re: UIInput
« Reply #51 on: April 07, 2014, 11:13:06 AM »
Alright so I just realized I can add scripts to my GUI objects and have the functions show up in the drop down menus. I used the function used on the first page of this thread ("MySubmitFunction"). It works as it should but how can I get it to show up in the chat area? If I use the OnSubmit function it'll show up just fine. Do I need to edit the ChatInput script and use that instead? Thanks.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,154
  • Toronto, Canada
    • View Profile
Re: UIInput
« Reply #52 on: April 08, 2014, 01:25:33 AM »
Input can be restricted to numeric-only input by choosing the appropriate Validation method.

All functions will show up as long as the are public.

gonzosan

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 4
    • View Profile
Re: UIInput
« Reply #53 on: April 08, 2014, 09:57:48 AM »
I have everything setup I'm just having issues adding the numeric values on the output side. I'm not sure what I need to modify. I'm playing around with "OnSubmit" function to get it to add numbers but it just displays them as a string. I know I need to change that but not sure if it's an issue within ChatInput or the textlist script. It's something simple but I'm having a hard time seeing what the issue is. Thanks for the help.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,154
  • Toronto, Canada
    • View Profile
Re: UIInput
« Reply #54 on: April 09, 2014, 04:14:38 AM »
I don't quite understand your post. What does OnSubmit have to do with any of this? I said set the appropriate Validation method on the UIInput.

gonzosan

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 4
    • View Profile
Re: UIInput
« Reply #55 on: April 10, 2014, 11:53:07 AM »
I need to add numbers when I hit submit. I have set the validation method in the settings in the inspector panel under the UIInput script, that's not an issue. That just makes it so that you can only input numbers but the output still acts like a string. So if I try to add whatever I input to another value it just shows up as a string. So for instance if I input 10 into the input box and go into the OnSubmit function and say
  1.  textList.Add(text + 12);

It displays as "1012". I want these numbers to add/subtract so what is the best way to do this?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,154
  • Toronto, Canada
    • View Profile
Re: UIInput
« Reply #56 on: April 11, 2014, 07:54:47 AM »
Like any other way of converting a string to an int in C#:
  1. int intValue;
  2. int.TryParse(stringValue, out intValue);

vinfang

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 2
    • View Profile
Re: UIInput
« Reply #57 on: May 09, 2014, 07:12:06 PM »
Is it possible for the UIInput and UILabel to perform a multi-line text wrap for user input? The combinations I'm trying to use between UIInput and UILabel only give me text that shrinks or it stays on one line but can go on forever.

EDIT: So for version 3.5.8, I edited the file UIInput.cs file by commenting out

1109  //if (offset > mDrawStart)
1110 //{
1111     //mDrawStart = offset;
1112     //SetPivotToRight();
1113 //}

And

1116  // If necessary, trim the front
1117  //if (mDrawStart != 0)();
1118  //processed = processed.Substring(mDrawStart, processed.Length - mDrawStart);

and with UIInput script having the character limit set to 0 and in the UILabel the Overflow is set to ClampContent and Alignment is set to Left, the text when I type it in to the Input text area I created allows text wrap with mult-lining.

Are these changes ok? So far things seem to work.
« Last Edit: May 09, 2014, 08:11:59 PM by vinfang »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,154
  • Toronto, Canada
    • View Profile
Re: UIInput
« Reply #58 on: May 09, 2014, 08:28:03 PM »
3.5.9 supports it natively, but if your changes work fine for you then that's ok.

vinfang

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 2
    • View Profile
Re: UIInput
« Reply #59 on: May 23, 2014, 03:49:02 AM »
I imported version 3.6.0 and tried out the new UIInput along with a UILabel to see if clamp content, multiline support worked as I typed in words into a UIInput and it doesn't multiline still. It just keeps going on forever on one line.

On the UIInput I have Standard InputType, default on return key, default keyboard type, and a 200 character limit. On the UILabel I pointed the UIInput to, the overflow is set to clampcontent, alignment is automatic, and max lines is 7.

Am I setting something wrong in either one of those scripts?