Places the insertion point in a field, makes a control active, or removes focus from all controls.
# Metadata
Platforms: desktop, server, mobile OS: mac, windows, linux, ios, android Introduced: 1.0 Security:
# Syntax
focus [on] object
# Params
- object : Any object on the current card.
# Examples
focus on field 1
focus on the mouseControl
focus on graphic "Move Me"
focus on nothing
# Description
Use the focus command to make a control active--that is, to make it receive any keystrokes the user types.
If the object's traversalOn property is false, it cannot receive the focus, and the focus command causes an error.
If the lookAndFeel is set to "Motif", the active control is outlined, and the control receives any keystrokes (and the messages associated with them).
If the lookAndFeel is set to "Appearance Manager" or "Macintosh", an outline is drawn around fields, images, and EPS whose showFocusBorder property is set to true. Otherwise, the appearance of the active control does not change, but it receives keystroke messages.
If the lookAndFeel is set to "Windows 95", a dotted outline is drawn within buttons when they receive the focus.
If the object is an unlock field, the insertion point is restored to the location at which it was located the last time the field was focused. If the field was not previously focused, then the insertion point is placed at the beginning of the text in the field.
Use the ``focus on nothing`` command to remove focus from all objects on a card.
# Tags
ui,
# See
- **property:** focusPattern, showFocusBorder, lockText, selected, lookAndFeel, focusColor, traversalOn - **message:** enterKey, focusIn, keyUp, tabKey, mouseLeave, mouseWithin, keyDown, focusOut, returnKey - **keyword:** control - **glossary:** property, EPS, error, insertion point, message, unlock, appearance, active control, command - **function:** focusedObject, mouseStack - **command:** select, focus - **object:** field, image, button