FOCUS (return control with focus)

Top  Previous  Next

FOCUS( )

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

SELECTED

FIELD

EVENT