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

## SYNOPSIS

1. touchhandle.input = function(touchhandle, val, box, x, y)
2. touchhandle.buttons = { ... button definitions ... }

## DESCRIPTION

This is the most high-level touch screen callback. Whenever a click happens, it is looked up in the touch.buttons table, which contains a list of clickable screen locations. If a match is found, the touch.input callback is called with that information.

The touch.buttons table contains a list of rectangle to value mappings. The rectangle indicates the area where a click is accepted. When a click in such an area is detected, the callback runs with the associated value in val.

Additionally the callback receives the matching rectangle in box and the click coordinates in x and y.

## NOTES

Callbacks are called from within event:poll().

## EXAMPLE

> > > > > > > > > > >
app = event.new() tch = touch.new(app) tch.buttons = { [gfx.rect(1, 40, 69, 50)] = "WHATEVER" } tch.input = function(tch, val, box, x, y) print(val, box, x, y) end while true do app:poll() end

At a click to coordinates 35,55, this will print:

WHATEVER 69x50+1+40 35 55

## SEE ALSO

touch:clearCallbacks, touch.click, touch.release, touch.event