Input focus

Far Manager

Input focus

For keyboard messages distribution the so-called keyboard input focus conception is used. Input focus is an attribute which applies to a dialog element. If the element has the focus it means that it receives all (nearly :)) keyboard messages from FAR Manager system queue.

The Dialog Manager can move input focus from one element to another. When you press Tab, Shift-Tab, or Alt-Symbol, the input focus moves to the next/previous dialog element, or to the element that have the corresponding hot-key defined, respectively.

The dialog callback function can track getting/losing the input focus of dialog controls. When an element gets the input focus, the callback function receives the DN_GOTFOCUS event. When an element loses the input focus, the callback function receives the DN_KILLFOCUS event. In responce to the DN_KILLFOCUS event the callback function can disallow focus loss by the element, by returning the value -1. The DN_GOTFOCUS event has only an informative meaning, i.e. you can't undo/prevent this event from happening.

FAR Manager Dialog API programming interface contains two messages which allow to get or change the control having the input focus. These messages are DM_GETFOCUS and DM_SETFOCUS correspondingly.

Listed below are dialog controls which can receive keyboard input focus (provided that there're no DIF_NOFOCUS and/or DIF_DISABLE flags set for them):

ItemDescription
DI_BUTTON Button.
DI_CHECKBOX Check Box.
DI_COMBOBOX Dropdown List (ComboBox).
DI_EDIT Edit Box.
DI_FIXEDIT Fixed-size Edit Box.
DI_LISTBOX List Box.
DI_PSWEDIT Password Input Box.
DI_RADIOBUTTON Radio Button.
DI_USERCONTROL Custom control element defined by a programmer.
See also: