Home Contents | # touch.new | Touch | Core4 Lua Event System

## SYNOPSIS

touchhandle = touch.new(app [,xoffset, yoffset [, driver, device]])

## DESCRIPTION

Create a new touch screen event handler. The handler is attached to the event processor passed in app.

Touch screen events are detected during the event loop inside event:poll() and reported to the callbacks touch.event(), touch.click() and touch.input().

The optional offset arguments are simply subtracted from the device coordinates before they are processed. Default values are both zero when not given or passed as nil. This can be useful when simulating a smaller display on a larger display.

By default, the handler opens a touch screen device that is auto-detectable by the kernel.

When using a serial attached Elo touchscreen, auto-detection is not possible. Pass the value "ELO" as driver and the name of the serial device as device to manually load the Elo driver.

## RETURN VALUE

On success, a touch event handler instance. If opening the input device fails, three values are returned: nil, a string describing the error (The result of the C library call strerror() on the errno code) and the errno number from the standard C library.

## EXAMPLE

> >
app = event.new() tch = touch.new(app)

## SEE ALSO

touch.event, touch.click, touch.input, touch:close