![]() |
EV_defaultHandler | Function (ROM Call 0x157) |
events.h |
void EV_defaultHandler (EVENT *event); |
Processes an event message using the default handler.
EV_defaultHandler performs some default actions with most common messages (event is the
pointer to the message which need to be processed). This function is very useful in user event
handlers, and it is often called to process any unhandled messages in handlers. Not all
messages are supported in EV_defaultHandler. This is a list of supported message types (unsupported
types are simply ignored) together with the description of the action performed by EV_defaultHandler:
CM_ACTIVATE | Registers and starts the menu for the running application (see EV_registerMenu). |
CM_DEACTIVATE | Ends custom and normal menus. |
CM_KEY_PRESS | Handles tokens, system and mode keys. This is maybe the most useful action performed by EV_defaultHandler. If the keypress is a simple key (i.e. a single character), nothing will happen. If the keypress is a token (like "sin", "ln" etc.), the appropriate string is sent (as a CM_PASTE_STRING message) to the application. The summary effects will be that the application will receive token as a sequence of single keypresses. So, tokens are all sent via EV_sendString and do not have to be processed as single keypresses (note that this will not cause problems if called from user event handlers, although it may cause recursion; see textedit.h header file for an useful example). If the keypress is system or mode key (see QSysKey and QModeKey), the corresponding action associated with the key (for example, opening a menu or a dialog) will be performed (see the example below this table). The chosen menu item is then sent as a CM_PASTE_STRING message to the current application (note however that VAR-LINK uses a CM_PASTE_HANDLE message instead), except for toolbar menus, where an appropriate menu ID is send as a message. Command keypresses STO, RCL, SWITCH, MODE, APPS, MEM, INS, CUT, PASTE etc. and OFF key (code 4363) are also handled via this handler, and all of them cause usual actions (keypresses like CUT, PASTE etc. only send an appropriate message to the application). |
CM_PASTE_STRING | Pastes the string in the event paste buffer. More precise, it sets an internal static pointer to points to event->extra.pasteText and does not nothing more. The event loop (see EV_eventLoop) will then send the string as individual keypresses to the current application. This means that the paste buffer is exported from the code, so this allows pasting large amounts of text. |
CM_PASTE_HANDLE | Frees the memory associated with handle event->extra.hPasteText. |
CM_STO | Sends CM_KEY_PRESS event filled with key code 22 (right arrow) to the current application. |
CM_RCL | Performs usual actions for the RCL key (open Recall dialog, etc.). After execution of the Recall dialog, the content of the variable is sent to the current application as a CM_PASTE_STRING message. |
EVENT ev; ... ev.Type = CM_KEY_PRESS; ev.extra.Key.Code = KEY_CHAR; EV_defaultHandler (&ev);After execution of the menu, the selected character will be sent as the event to the current application (it may be captured through an user event handler).