# register_key_event_handler {{< callout context="note" title="NOTE" icon="outline/bulb" >}} Deprecated. Use `fsEventsRegisterKeyEventHandler` instead. {{< /callout >}}   The **register\_key\_event\_handler** function registers a key event callback function.   ##### Syntax ``` wasm void register_key_event_handler( GAUGE_KEY_EVENT_HANDLER handler, PVOID userdata ); ```   ##### Members
ParametersDescription
handler

Specifies the handler function, which should match the following definition:

typedef void (*GAUGE_KEY_EVENT_HANDLER) (ID32 event, UINT32 evdata, PVOID userdata);

userdataSpecifies an optional value for use by the gauge developer. This value will be returned to the key event handler function, whenever it is called.
  ##### Return Values This function does not return a value.   ##### Example This example shows how to receive custom numeric events from part animations.   Defined in `gauges.h`: ``` wasm const int EVENT_BUTTON_PUSH = 0x11000; ``` Code in the gauge handler: ``` wasm bool g_ButtonState = false; void EventHandler(ID32 event, UINT32 evdata, PVOID userdata) { switch(event) { case EVENT_BUTTON_PUSH: g_ButtonState = !g_ButtonState; break; default: break; } } void FSAPI module_init(void) { if (NULL != Panels) { ImportTable.PANELSentry.fnptr = (PPANELS)Panels; PanelCallbackInit(); } register_key_event_handler((GAUGE_KEY_EVENT_HANDLER)EventHandler, NULL); } ```   ##### Remarks Note that `GAUGE_KEY_EVENT_HANDLER` is **deprecated** along with this function and you should instead be using `GAUGE_KEY_EVENT_HANDLER_EX1` along with the `register_key_event_handler_EX1` function.