1
NGUI 3 Support / Re: Avoid line-break in UIInput
« on: October 22, 2014, 04:02:46 AM »
Had to check the UIInput.cs file to know how to ignore newlines, and I found this:
So in order to avoid newlines, you need to do:
UILabelObject.multiLine = false;
UIInputObject.onReturnKey = UIInput.OnReturnKey.Default;
Doing that, bool newLine becomes false and performs Submit();
- case KeyCode.KeypadEnter:
- {
- ev.Use();
- bool newLine = (onReturnKey == OnReturnKey.NewLine) ||
- (onReturnKey == OnReturnKey.Default &&
- label.multiLine && !ctrl &&
- label.overflowMethod != UILabel.Overflow.ClampContent &&
- validation == Validation.None);
- if (newLine)
- {
- //Insert("\n");
- }
- else
- {
- UICamera.currentScheme = UICamera.ControlScheme.Controller;
- UICamera.currentKey = ev.keyCode;
- Submit();
- UICamera.currentKey = KeyCode.None;
- }
- return true;
- }
So in order to avoid newlines, you need to do:
UILabelObject.multiLine = false;
UIInputObject.onReturnKey = UIInput.OnReturnKey.Default;
Doing that, bool newLine becomes false and performs Submit();
