SetFocus

Description

Sets the focus on the specified object or control.

Applies to

Any object

Syntax

objectname.SetFocus ( )

Argument

Description

objectname

The name of the object or control in which you want to set the focus


Return value

Integer.

Returns 1 if it succeeds and -1 if an error occurs. If objectname is null, SetFocus returns null.

Usage

If objectname is a ListBox, SetFocus displays the focus rectangle around the first item. If objectname is a DropDownListBox, SetFocus highlights the edit box. To select an item in a ListBox or DropDownListBox, use SelectItem.

Drawing objects cannot have focus. Therefore, you cannot use SetFocus to set focus to in a Line, Oval, Rectangle, or RoundRectangle.

Examples

This statement in the script for the Open event in a window moves the focus to the first item in lb_Actions:

lb_Actions.SetFocus()

See also

SetItem

SetState

SetTop