Set click handler for a GUI element

setonclick widget [instructions]
setonclick widget function

Set the list of instructions or a function which should handle the click event for the widget. A :sender variable which contains the clicked widget is available to the list of instructions. If the handling function is specified then the clicked widget is the first argument of this function.

Example:

"k := newarray 4
for [i 1 4] [
  :k,:i := label word "Label :i array 10 24 * :i
  setonclick :k,:i [print gettext :sender]
]

Output:
Labels in the graphics window which are reacting to clicks.

Label4
Label3
Label1
Label3

See also:

Table of Content