Vicon Shogun banner

Description

Gets the input focus, if it belongs to a user control. If no user control has the input focus, 0 is returned.

Only one control (either user or native) can have the input focus at any one time. The control with the input focus is the one that receives keyboard and mouse input.

You can set the focus to a user control so that it will be the recipient of keyboard and mouse messages. The input focus is lost when the user clicks outside of the control, or tabs outside of it.

Functional area

User Window

Command syntax

Syntax

getFocus

Arguments

None

Flags

None

Return value

integer

Examples

// Get the input focus.
int $windowId;
int $controlId;
int $focusId;

// First create a User Window to place the Control on
$windowId = `createWindow "MyWindow"`;

// Create a Text Box Control in the window.
$controlId = `createTextBox $windowId`;

// Set the focus to our Text Box
setFocus $controlId;

// Get the focus. $focusId and $controlId should now match
$focusId = `getFocus`;

if( $focusId == $controlId )
{
print "Match!";
}

Additional information

Related commands