Sets the focus on the specified object or control.
Any object
objectname.SetFocus ( )
Argument |
Description |
---|---|
objectname |
The name of the object or control in which you want to set the focus |
Integer. Returns 1 if it succeeds and -1 if an error occurs. If objectname is null, SetFocus returns null.
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.
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()