register_key_event_handler (Deprecated)

The register_key_event_handler function registers a key event callback function.

IMPORTANT! This is a deprecated function and you should be using register_key_event_handler_EX1 instead.

 

 

Syntax
void register_key_event_handler(
    GAUGE_KEY_EVENT_HANDLER  handler,
    PVOID  userdata
    );

 

Members
Parameters Description
handler

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

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

userdata Specifies 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:

const int EVENT_BUTTON_PUSH = 0x11000; 

Code in the gauge handler:

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.

 

See Also