| 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.

Useful examples for this functions may be found in textedit.h header file. Here is another simple example which ilustrates how you can open the "CHAR" menu. This may be useful if you want to make your user input routine which allows inserting extra characters:

    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).

Uses: ABT_dialog, CAT_dialog, EV_captureEvents, EV_eventLoop, EV_restorePainting, EV_sendEvent, EV_sendString, EV_startApp, EV_suspendPainting, EV_switch, handleRclKey, handleVarLinkKey, MO_currentOptions, MO_digestOptions, MO_modeDialog, MO_option, MO_sendQuit, HeapAlloc, HeapDeref, HeapFree, HeapFreeIndir, HeapLock, HeapUnlock, push_ratio, Dialog, DialogAdd, DialogDo, DialogNew, DlgMessage, ER_catch, ER_success, ER_throwVar, ERD_dialog, HToESI, push_Float, push_internal_simplify, top_estack, FontCharWidth, gr_active, memcmp, memcpy, memset, DynMenuAdd, MenuBegin, MenuEnd, MenuKey, PopupDo, PopupNew, PopupText, ST_modKey, ST_helpMsg, sprintf, strcat, AB_getGateArrayVersion, CU_cursorState, CU_restore, HelpKeys, off, OSClearBreak, XR_stringPtr, TE_focus, TE_openFixed, TE_select, fabs, fmod, CustomBegin, CustomEnd, CustomMenuItem, EV_appA, EV_appB, EV_appSide, EV_currentApp, EV_quit, EV_runningApp, has_unit_base, OO_firstACB, OO_GetAppAttr, OO_NextACB, OO_SetAppAttr, FolderOp, SymFindFirst, SymFindNext, VarStore, DrawStaticButton, MakeWinRect, WinActivate, WinAttr, WinBitmapPut, WinClr, WinFill, WinFillTriangle, WinFont, WinLine, WinOpen, WinRect, WinScrollV, WinStrXY, _bcd_math, ROM Call 0x3CD, ROM Call 0x46F, ROM Call 0x471, ROM Call 0x4FB, ROM Call 0x5F1, ROM Call 0x5F3, ROM Call 0x5F7, ROM Call 0x5FE, ROM Call 0x601, WinBeginPaint
Used by: GD_Circle, GD_Eraser, GD_HVLine, GD_Line, GD_Pen, GD_Select, GD_Text, GZ_Box, HomeExecute, fgetchar, gets, getsn, EV_quit, GT_FreeTrace, GT_KeyIn, GT_Trace, ROM Call 0x5F3