XPLMHandleKey f

From X-Plane SDK
Revision as of 13:15, 15 April 2009 by Bsupnik (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

XPLMHandleKey_f

typedef void (* XPLMHandleKey_f)(
                                   XPLMWindowID         inWindowID,    
                                   char                 inKey,    
                                   XPLMKeyFlags         inFlags,    
                                   char                 inVirtualKey,    
                                   void *               inRefcon,    
                                   int                  losingFocus);    
This function is called when a key is pressed or keyboard focus is taken away from your window. If losingFocus is 1, you are losign the keyboard focus, otherwise a key was pressed and inKey contains its character. You are also passewd your window and a refcon. Warning: this API declares virtual keys as a signed character; however the VKEY #define macros in XPLMDefs.h define the vkeys using unsigned values (that is 0x80 instead of -0x80). So you may need to cast the incoming vkey to an unsigned char to get correct comparisons in C.