Assigning focus to a control?

I want the Enter key to assign focus to a text entry field for chat. I know about how GUIUtility.keyboardControl is the widget that has the text cursor. GUIUtility.GetControlID sounds like it should be what to use to find the ID I want to stick there, but the documentation page looks like a copypaste mistake and doesn’t show how to use it.

Anyone use these successfully?

GetControlID is used to generate a unique ID for a GUI control, not for looking up a control’s id.

Try using GUI.SetNextControlName with GUI.FocusControl.

Rawk! That makes sense when I remember that GUI is stream-of-consciousness. “Next” means the next control that I mention. So…

GUI.SetNextControlName( "ChatEntry" );
myText = GUI.TextField(sendRect, myText, 64);

and

if( Input.GetButtonDown( "Shaun Rocks" ) )
   GUI.FocusControl( "ChatEntry" );