| **Navigation:**  [[introduction.htm|Language Reference]] > 13 - Built-in Functions >====== FIELD (return control with focus) ====== | [[exists return file existence .htm|{{btn_prev_n.gif|Previous page}}]][[introduction.htm|{{btn_home_n.gif|Return to chapter overview}}]][[filedialog return chosen file .htm|{{btn_next_n.gif|Next page}}]] | | || {{newc7.jpg|NewC7.jpg}} **FIELD( )** {{blk2blue.jpg|blk2blue.jpg}} The **FIELD** procedure returns the field number of the control which has focus at the time of any field-specific event. This includes both the EVENT:Selected and EVENT:Accepted events. FIELD returns zero (0) for field-independent events. 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:** **Screen WINDOW** **        ENTRY(@N4),USE(Control1)** **        ENTRY(@N4),USE(Control2)** **        ENTRY(@N4),USE(Control3)** **        ENTRY(@N4),USE(Control4)** **       END** ** CODE** ** ACCEPT** **  IF NOT ACCEPTED()** **   CYCLE** **  END** **  CASE ****FIELD****()          !Control edit control** **   OF ?Control1         !Field number 1** **    IF Control1 = 0     !if no entry** **     BEEP               !sound alarm** **     SELECT(?)          !stay on control** **    END** **  OF ?Control2          !Field number 2** **   IF Control2 > 4      !if status is more than 4** **    Scr:Message = 'Control must be less than 4'** **    ERASE(?)            !clear control** **    SELECT(?)           !edit the control again** **   ELSE                 !value is valid** **    CLEAR(Scr:Message)  !clear message** **   END** **  OF ?Control4          !Field number 4** **   BREAK                !exit processing loop** **  END** ** END                    !end case, end loop** **See Also:** [[accept the event processor .htm|ACCEPT]] [[accepted return control just completed .htm|ACCEPTED]] [[selected return control that has received focus .htm|SELECTED]] [[focus return control with focus .htm|FOCUS]] [[event return event number .htm|EVENT]]