FocusID

(Engine-Level Function)

Description: Returns the focus ID of the object in a window that has the input focus.
Returns: Numeric
Usage: Script Only.
Function Groups: Window,  Graphics,  Keyboard
Related to: NextFocusID
Format: FocusID(Window)
Parameters:  
Window
Required. Any object value that will specify the instance of a window.
Local
Optional Boolean. If True then focus calls are module-specific (i.e. local to the module calling Focus.)
Comments:

If the window is inactive, this function will return the focus ID of the object that will receive the input focus when the window becomes active.

FocusID values have a valid range of 0 to 32767. Values outside this range are likely to cause the object to vanish.

Example:

  ZButton(10, 100, 110, 130, "OK", 1);
  If LocSwitch() == 4 { Left mouse button pressed };
  [
    IfThen(FocusID(Self()) != 1 { Focus leaves the OK button },
          NextFocusID(Self(), 1) { Return focus to OK button });
  ]

This set of statements ensures that after any input by the mouse (i.e. clicking of the left mouse button), the focus will return to the "OK" button.