# ViewerEventData

If a script implements the [**OnViewerEvent**](../scripting_events/onviewerevent) event, it receives a **ViewerEventData** object whenever certain events occur in a standalone [image viewer](../../../additional_functionality/viewing_images).

&#x20;

| Property Name | Return Type                   | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| ------------- | ----------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| event         | _string_                      | <p>Returns a string indicating the event that occurred. The events currently defined are:</p><ul><li><strong>create</strong>: A new viewer has been created.</li><li><strong>destroy</strong>: A viewer window has been destroyed.</li><li><strong>load</strong>: A new image has been loaded in a viewer. The <strong>item</strong> property can be used to find out which file was loaded.</li><li><strong>setfocus</strong>: The viewer window has received focus (gone active).</li><li><strong>killfocus</strong>: The viewer window has lost focus (gone inactive).</li><li><strong>click</strong>: The left button was clicked on the image (requires mouse buttons to be set to trigger <em>Script event</em> in <strong>Preferences / Viewer / Mouse Buttons</strong>).</li><li><strong>dblclk</strong>: The left button was double-clicked on the image.</li><li><strong>mclick</strong>: The middle button was clicked on the image.</li></ul> |
| item          | _object:_[**Item**](item)     | For the **load** event, returns an [**Item**](item) object representing the newly loaded image.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| viewer        | _object:_[**Viewer**](viewer) | Returns a [**Viewer**](viewer) object representing the viewer the event occurred in.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| x             | _int_                         | For the click events, returns the x coordinate within the viewer window that the click occurred.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| y             | _int_                         | For the click events, returns the y coordinate within the viewer window that the click occurred.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| w             | _int_                         | For the click events, returns the width of the viewer window.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| h             | _int_                         | For the click events, returns the height of the viewer window.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
