static function FocusControl (name : string) : void
Description
Move keyboard focus to a named control.
See Also: SetNextControlName, GetNameOfFocusedControl.
var username :
String =
"username";
var pwd :
String =
"a pwd";
function OnGUI () {
GUI.SetNextControlName (
"MyTextField");
username =
GUI.TextField (
Rect (10,10,100,20), username);
pwd =
GUI.TextField (
Rect (10,40,100,20), pwd);
if (
GUI.Button (
Rect (10,70,80,20),
"Move Focus"))
GUI.FocusControl (
"MyTextField");
}
using UnityEngine;
using System.Collections;
public class example :
MonoBehaviour {
public string username =
"username";
public string pwd =
"a pwd";
void OnGUI() {
GUI.SetNextControlName(
"MyTextField");
username =
GUI.TextField(
new Rect(10, 10, 100, 20), username);
pwd =
GUI.TextField(
new Rect(10, 40, 100, 20), pwd);
if (
GUI.Button(
new Rect(10, 70, 80, 20),
"Move Focus"))
GUI.FocusControl(
"MyTextField");
}
}
import UnityEngine
import System.Collections
class example(
MonoBehaviour):
public username as
string = 'username'
public pwd as
string = 'a pwd'
def
OnGUI():
GUI.SetNextControlName('MyTextField')
username =
GUI.TextField(
Rect(10, 10, 100, 20), username)
pwd =
GUI.TextField(
Rect(10, 40, 100, 20), pwd)
if GUI.Button(
Rect(10, 70, 80, 20), 'Move Focus'):
GUI.FocusControl('MyTextField')