When a key is pressed, a pointer to this struct is passed to your widget function.

typedef struct {
     // The ASCII key that was pressed.  WARNING: this may be 0 for some non-ASCII key sequences.
     char                      key;
     // The flags.  Make sure to check this if you only want key-downs!
     XPLMKeyFlags              flags;
     // The virtual key code for the key
     char                      vkey;
} XPKeyState_t;