Before updating to Windows 10 you may need to return your Pro license. More information here

GUI.FocusControl() and TextFields - Prevent selection

So I have something like this:

 //more GUILayout functions above...
 enteredText = GUILayout.TextField(enteredText);
 //... and more GUILayout functions below

What I want is for the text field to always be selected (hence the immediate focus control). Above this there is a section with changing layouts, which causes the text field to become unselected. When GUI.FocusControl() is in there, it maintains control of the text field, but it always selects ALL of the text any time there is a change above. If I'm typing something when it does this, it immediately deletes everything in the field.

My main question is, how do I keep focus on the text field without selecting all the text every time the layout changes? Is there a better way to handle this?

more ▼

asked Sep 18, 2012 at 04:30 PM

avatar image

20 25 24 26

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

1 answer: sort voted first
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



Answers and Comments



asked: Sep 18, 2012 at 04:30 PM

Seen: 2209 times

Last Updated: Feb 25, 2013 at 08:40 PM