# register_key_event_handler_EX1 The **register\_key\_event\_handler** function registers a key event callback function. {{< callout context="caution" title="IMPORTANT!" icon="outline/alert-triangle" >}} This function replaces the deprecated `register_key_event_handler` function. {{< /callout >}}   ##### Syntax ``` wasm void register_key_event_handler_EX1( GAUGE_KEY_EVENT_HANDLER_EX1 handler, PVOID userdata ); ```   ##### Members
ParametersDescription
handler

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

typedef void (*GAUGE_KEY_EVENT_HANDLER_EX1) (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 evdata0, UINT32 evdata1, UINT32 evdata2, UINT32 evdata3, UINT32 evdata4, 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_EX1((GAUGE_KEY_EVENT_HANDLER_EX1)EventHandler, NULL); } ```   ##### Remarks N/A