checkCtlFocus

Syntax

int checkCtlFocus(int n)

Arguments

n
The number of the control to check for focus

Return

Returns true if the given control has focus, false otherwise.

Description

Checks if a given control currently has the user's focus (ie is currently highlighted and responding to keyboard controls after recently being clicked on).

Example

ctl[0]: STANDARD, "Control 0"
ctl[1]: STANDARD, "Control 1"
ctl[8]: STATICTEXT, "Which control has focus?"

OnCtl(n): {
  if (checkCtlFocus(0)) {
    setCtlText(8, "Control 0 has focus");
  }
  else if (checkCtlFocus(1)) {
    setCtlText(8, "Control 1 has focus");    
  }
  else {
    setCtlText(8, "");
  }
  return true;
}

See Also

setCtlFocus