[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ] |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

#### 4.18.3.2 Events: Responding To User Actions

Events are broken out into `OnBlah()` functions. The parameters for those events are also broken out and passed to the functions. At the end of any of the `OnBlah()` event functions (except `OnDraw()`) you should return ``true'` if the event was used by you, otherwise return ``false'`. You must override all event functions, even if you don't use them all. If you will not use a particular event, just return ``false'`.

It's important to note that you will only receive events that apply to your component. For example, if the mouse is inside your component, you will receive all mouse events. However, once the mouse leaves the confines of your borders you will no longer receive any mouse events. The only exception to this is the `OnMouseExit()` event which is sent to the component that just lost the mouse.

The following is the list of all events understood by components:

`virtual bool OnMouseDown(int button, int x, int y)`

  Triggered when the user presses a mouse button.

`virtual bool OnMouseUp(int button, int x, int y)`

  Triggered when the user releases a mouse button.

`virtual bool OnMouseMove(int button, int x, int y)`

  Triggered when the user moves the mouse.

`virtual bool OnMouseClick(int button, int x, int y)`

  Triggered when the user clicks the mouse.

`virtual bool OnMouseDoubleClick(int button, int x, int y)`

  Triggered when the user double clicks the mouse.

`virtual bool OnMouseExit()`

  Triggered when this component loses mouse focus.

`virtual bool OnMouseEnter()`

  Triggered when this component gains mouse focus.

`virtual bool OnKeypress(int key, int modifiers)`

  Triggered when the user presses a key.

`virtual bool OnLostFocus()`

  Triggered when the keyboard focus is lost.

`virtual bool OnGainFocus()`

  Triggered when the keyboard focus is gained.

[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ]

This document was generated using texi2html 1.76.