Go to: Synopsis. Return value. Python examples.

Synopsis

setFocus( string )

Note: Strings representing object names and arguments must be separated by commas. This is not depicted in the synopsis.

setFocus is undoable, NOT queryable, and NOT editable.

Give keyboard focus to a specific control or panel, passed as an argument.

Return value

None

Python examples

import maya.cmds as cmds

cmds.window()
cmds.columnLayout()
cmds.textField('tf0', changeCommand='cmds.setFocus("tf1")' )
cmds.textField('tf1', changeCommand='cmds.setFocus("tf2")' )
cmds.textField('tf2', changeCommand='cmds.setFocus("tf0")' )
cmds.showWindow()