focus

Typecommand
DictionaryLCS
LibraryLiveCode Script
Syntax
focus [on] <object>
focus on nothing
Summary

Places the insertion point in a field, makes a control active, or removes focus from all controls.

Introduced1.0
OSmac, windows, linux, ios, android
Platformsdesktop, server, mobile
Parameters
NameTypeDescription
object

Any object on the current card.

Example
focus on field 1
focus on the mouseControl
focus on graphic "Move Me"
focus on nothing
RelatedProperty: 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
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 focusedcontrol 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 objects whose showFocusBorder property is set to true. Otherwise, the appearance of the focused 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 unlocked 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.

Tagsui