# ProcessEditorEvent

The ProcessEditorEvent function informs plugins about different internal editor events.

    int WINAPI ProcessEditorEvent(
      int Event,
      void *Param
    );

### Parameters

Event
Event type.
Can be one of the following values (EDITOR_EVENTS enum):

Event | Description
--- | ---
EE_CLOSE | One of the internal editors is closing. Plugins can use this event to free internal data structures. Note that several editors can be active at the same time. Param points to an integer variable containing the EditorID parameter of the editor instance beeing closed. The EditorID of the current editor can be obtained earlier using the ECTL_GETINFO EditorControl command. But the plugin should not call the EditorControl function when processing this event, because the editor is already closed. Return value must be 0. Remark. Starting with FAR 1.70 build 1989 only the following commands can be used from EE_CLOSE ECTL_GETINFO and ECTL_GETBOOKMARKS.
EE_READ | A new file has just been read. The plugin can use EditorControl commands to modify the read data. Param equals NULL. Return value must be 0.
EE_SAVE | The file being edited is about to be saved. The plugin can use EditorControl commands to modify data before saving. Param equals NULL. Return value must be 0.
EE_REDRAW | The editor screen is about to redraw. Plugin can use EditorControl ECTL_ADDCOLOR command to set line colors. Param can be one of the following vslue:
Constans | Description
--- | ---
EEREDRAW_ALL | The whole screen will be redrawn
EEREDRAW_LINE | Only the current line will be redrawn
EEREDRAW_CHANGE | Redrawing caused by text change In the case of EEREDRAW_CHANGE the current line or the whole screen might be redrawn. So if changes were made to the highlighting outside the current line, it is recomended to call ECTL_REDRAW when you finished highlighting. Otherwise those changes will be seen only after cursor movement or other actions that cause screen redraw. Most important is not to enter recursion upon doing so.
Return value must be 0.
EE_KILLFOCUS | Editor has lost keyboard focus. Param points to a variable containing the EditorID of the editor that looses focus. Return value must be 0.
EE_GOTFOCUS | Editor received keyboard focus. Param points to a variable containing the EditorID of the editor that receives focus. Return value must be 0.

Attention!

- When processing EE_REDRAW it is HIGLY UNDESIRABLE TO CALL Info.Message, Info.Menu, Info.Dialog and Info.DialogEx. Calling those function leads to recursive calling of EE_REDRAW.

Param
Points to data dependent on the event type.

### Return value

Return value depends on the event type.
Return 0 for unknown event types.

### Remarks

- EE_READ is called only once for each file.
- EE_SAVE is called every time F2 or Shift-F2 is pressed.
- EE_REDRAW is called every time the screen is redrawn (for example, after moving the cursor).