Enable / disable event handling function

eventenable name
eventdisable name

The instruction eventenable enables handling of an event with given name by a corresponding function while eventdisable) suspends handling of the event.

Example:

to onmouseclick
  print who
end

"t := anewt [setname "t eventenable "onmouseclick]
"u := anewt [setname "u]

eventdisable "onmouseclick

Output:
Only turtle #t is responding to mouse clicks. Turtle #u did not call eventenable and therefore handling of the mouse clicks stays disabled (this is the default behaviour for event handlers defined in parent turtles). Event handling is enabled by default for the turtle #first, which disables it with the instruction eventdisable.

t
t
t
...

See also:

Event and signal handling functions
Turtle - object

Table of Content