You can create one callback function that's used for every panel and check for your desired keyboard sequence there. You have to edit each panel to enter the callback function name.
1. In the UI editor, select the main panel.
2. Double-click on a blank spot on the panel to edit the panel (or use the menu to select Edit >> Panel).
3. Enter a function name (e.g. CheckKeypress) in the Callback Function box and click OK.
4. In the UI editor, from the menu select Code >> Set Target File and choose your C file.
5. In the UI editor (with the main panel still selected), from the menu select Code >> Generate >> Panel Callback.
5. In the UI editor (with the main panel still selected), from the menu select Code >> View >> Panel Callback.
6. In the code window, delete case
s in your panel callback which you won't use.
7. Add a new case for EVENT_KEYPRESS:
int keyCode;
switch (event)
{
case EVENT_KEYPRESS:
if ((keyCode = GetKeyPressEventVirtualKey (eventData2)) == 6656)
MessagePopup ("Key Trapped", "Ctrl-F12 was trapped");
break;
Instead of just a MessagePopup, you'll do whatever you want in your shutdown procedure.
6656 is the virtual keycode for Ctrl-F12. The easiest way for me to find virtual keycodes is to set a breakpoint after GetKeyPressEventVirtualKey(), run the program, and see what the return value is (keyCode in this example).
8. Select each of the other panels in your user interface, one by one, edit the panel, and add the name of the callback function you created for the main panel. This way, all panels will use the same callback and can use the same keystroke to call the shutdown procedure. Note that you're just setting the callback function name to be the same for each panel. You have to create only one cal
lback and then tell all panels to use it.