YOU ARE VIEWING DOCUMENTATION FOR ioL v.1. Click here for documentation for older v.0.9x versions of ioL.
ioL

Programming manual (doc.iol.science)



mouse = ...

ioL creates and manages this field automatically when you have assign a handler to any of the following event fields:

Whenever one of the above events occurs (and you are listening for it), ioL will update the mouse field with three numerical elements corresponding to current the mouse status. These are (by element index):

  1. The mouse button currently being pressed (or 0)
  2. The horizontal mouse pointer co-ordinate relative to left-hand edge of the markup element, in pixels.
  3. The vertical mouse pointer co-ordinate relative to top edge of the markup element, in pixels.

At the same time, ioL will update the program element's mouse field to contain the current absolute mouse data (pointer co-ordinates relative to the top-left corner of the entire program console).

To access individual elements within this field, use the .@ operator.

Example

This example fills the console window with a box that updates its contents with the current mouse pointer position each time a mouse movement is detected over the box. The absolute co-ordinates differ slightly from the relative co-ordinates due to the border width of the box, and the margins of the program element.

<mousetracker:box width=100,{%} height=100,{%} onmousemove= 
    <mousetracker.clear>,
    <mousetracker.push {
        relative mouse X co-ordinate: <mouse.@ 2></n>
        relative mouse Y co-ordinate: <mouse.@ 3></p>
        absolute mouse X co-ordinate: <program.mouse.@ 2></n>
        absolute mouse Y co-ordinate: <program.mouse.@ 3></p>
        mouse button at last movement of mouse: <mouse.@ 1>
    }>
>