| **Navigation:**  [[introduction.htm|Language Reference]] > 13 - Built-in Functions >====== FOCUS (return control with focus) ====== | [[flush flush buffers .htm|{{btn_prev_n.gif|Previous page}}]][[introduction.htm|{{btn_home_n.gif|Return to chapter overview}}]][[fontdialog return chosen font .htm|{{btn_next_n.gif|Next page}}]] | | || {{newc7.jpg|NewC7.jpg}} **FOCUS( )** {{blk2blue.jpg|blk2blue.jpg}} The **FOCUS** procedure returns the field number of the control which has received the last EVENT:SELECTED event among the other controls (not menu items) of the active window. Positive field numbers are assigned by the compiler to all WINDOW controls, in the order their declarations occur in the WINDOW structure. Negative field numbers are assigned to all APPLICATION controls. In executable code statements, field numbers are usually represented by field equate labels--the label of the USE variable preceded by a question mark (?FieldName). | **Return Data Type:** | SIGNED | **Example:** **W WINDOW** **   ENTRY(@N4),USE(Control1)** **   ENTRY(@N4),USE(Control2)** **   ENTRY(@N4),USE(Control3)** **   END** ** CODE** ** OPEN(W)** ** ACCEPT** **  CASE EVENT()** **   OF EVENT:LoseFocus** **   OROF EVENT:CloseWindow** **    CASE ****FOCUS****()         !Control edit control** **     OF ?Control1        !Field number 1** **      UPDATE(?Control1)** **     OF ?Control2        !Field number 2** **      UPDATE(?Control2)** **     OF ?Control3        !Field number 3** **      UPDATE(?Control3)** **    END** **  END** ** END** **See Also:** [[accepted return control just completed .htm|ACCEPTED]] [[selected return control that has received focus .htm|SELECTED]] [[field return control with focus .htm|FIELD]] [[event return event number .htm|EVENT]]