WIDGET_API XPWidgetID XPSetKeyboardFocus( XPWidgetID inWidget);
XPSetKeyboardFocus controls which widget will receive keystrokes. Pass the Widget ID of the widget to get the keys. Note that if the widget does not care about keystrokes, they will go to the parent widget, and if no widget cares about them, they go to X-Plane.
If you set the keyboard focus to Widget ID 0, X-Plane gets keyboard focus.
This routine returns the widget ID that ended up with keyboard focus, or 0 for x-plane.
Keyboard focus is not changed if the new widget will not accept it. For setting to x-plane, keyboard focus is always accepted.