Sidebar

reference:scripting_reference:scripting_objects:viewereventdata

If a script implements the OnViewerEvent event, it receives a ViewerEventData object whenever certain events occur in a standalone image viewer.

 

Property Name Return Type Description

event

string

Returns a string indicating the event that occurred. The events currently defined are:

  • create: A new viewer has been created.
  • destroy: A viewer window has been destroyed.
  • load: A new image has been loaded in a viewer. The item property can be used to find out which file was loaded.
  • setfocus: The viewer window has received focus (gone active).
  • killfocus: The viewer window has lost focus (gone inactive).
  • click: The left button was clicked on the image (requires mouse buttons to be set to trigger Script event in Preferences / Viewer / Mouse Buttons).
  • dblclk: The left button was double-clicked on the image.
  • mclick: The middle button was clicked on the image.

item

object:Item 

For the load event, returns an Item object representing the newly loaded image.

viewer

object:Viewer 

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