x


Avoid auto device capitalization for textfields on mobile

Is there a way to avoid having the device auto-capitalize the first letter for Unity GUI textfields on mobile?

more ▼

asked Jun 08, 2011 at 07:40 AM

ina gravatar image

ina
4.4k 1619 1255 1299

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first
var lastStringLen = stringToEdit.Length;
stringToEdit = GUI.TextField (Rect (10, 10, 200, 20), stringToEdit, 25);
if (lastStringLen == 0 && stringToEdit.Length == 1)
  stringToEdit = stringToEdit.ToLower();
more ▼

answered Jun 08, 2011 at 07:38 PM

DaveA gravatar image

DaveA
33.4k 417 336 443

that forces everything to lowercase, though... what about preventing the device from auto-capitalization, but allowing the user to capitalize if they choose

Jun 08, 2011 at 07:41 PM ina

Edited answer. It will look to see if an empty input became a single character, if so, will lower it. Otherwise it leaves it alone.

Jun 08, 2011 at 07:56 PM DaveA
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x5724
x880
x872
x237

asked: Jun 08, 2011 at 07:40 AM

Seen: 1662 times

Last Updated: Jun 08, 2011 at 07:56 PM