reference / running
on
Runs a block when something happens: a key, a mouse button, a finger, a window change, or a message. A window may be named first, and a mouse button after mouse down or mouse up.
size = 20on mouse down [ size = size + 10 ]on key "space" [ size = 20 ]draw [ background 240 circle at 200 150 radius size fill gold]
How to write it
on key "name" [ ... ]on mouse down [ ... ]on mouse down right [ ... ]on touch down [ ... ]on touch up [ ... ]on window event [ ... ]on window receive message [ ... ]What it can wait for
on key- Runs when the named key goes down.
on mouse down- Runs when a mouse button goes down; name one to wait for it alone:
on mouse down right. on mouse up- Runs when a mouse button comes up; name one to wait for it alone:
on mouse up left. on touch down- Runs when a finger touches the screen;
fingeris that finger:finger.pos,finger.id. on touch up- Runs when a finger leaves the screen;
fingeris that finger, where it was last. on resize- Runs when the window changes size.
on move- Runs when the window moves.
on focus- Runs when the window gains or loses focus.
on window receive name- Runs when another window sends this one a value with
send;nameholds it.