AIT_CtrlSetFocus

Description

Sets the focus on a specific control.

Format

bool AIT_CtrlSetFocus (
 string strCaption,     // Control's caption
 integer nCtrlType      // Control type
 [,float fTimeOut]      // Time-out
);
bool AIT_CtrlSetFocus (
 integer nCtrlID,       // Control ID
 integer nCtrlType      // Control type
 [,float fTimeOut]      // Time-out
);
bool AIT_CtrlSetFocus (
 integer nIndex         // Control's index
 [,float fTimeOut]      // Time-out
);

Parameters

strCaption (input)

Specify the caption of a control.

nCtrlID (input)

Specify a control ID.

nCtrlType (input)

Specify a control type, which must be one of the following values.

ValueDescription
BUTTON_CTRLThe control type is a command button.
CHECKBOX_CTRLThe control type is a check box.
OPTIONBUTTON_CTRLThe control type is an option button.
EDIT_CTRLThe control type is an edit box.
STATIC_CTRLThe control type is a static text.
COMBO_CTRLThe control type is a combo box.
LISTBOX_CTRLThe control box is a list box.
SPIN_CTRLThe control type is a spin control.
TREE_CTRLThe control type is a tree control.
LIST_CTRLThe control type is a list control.
DTPICKER_CTRLThe control type is a date/time picker.

nIndex (Can be entered)

Specify the tab order of the control.

fTimeOut (input, optional)

Specify the maximum time the function can use to find the control, in units of seconds. The default is the value set in the AIT_SetDefaultWaitTimeout function.

Return values

The return value is true if the function was executed normally, and false if not.

If the function has returned false, you can use AIT_GetLastError to acquire an extended error code. The following gives the error codes that AIT_GetLastError might return:

Extended error numberError code
8ERROR_NOT_ENOUGH_MEMORY
14ERROR_OUTOFMEMORY
87ERROR_INVALID_PARAMETER
112ERROR_DISK_FULL
1400ERROR_INVALID_WINDOW_HANDLE
1460ERROR_TIMEOUT

Note

You can identify the control by using a complete caption or an associated label name or specifying the first part of such a caption or label name. When specifying the first part, prefix a swung dash (~) to the character string that you specify.