Set value changed handler for a GUI element

setonchange widget [instructions]
setonchange widget function

Set the list of instructions or a function which should handle a value changed event for the widget (text changed in the text box, checbox state changed, slider moved). The following variables are available to the list of instructions:

  :sender - affected widget
  :new - new value
  :old - previous value

If the handling function is specified then the above variables are available as the arguments.

Example:

"s := (slider "Slider {30 10} {1 10 1})
setonchange :s [(print :old "|->| :new)]

Output:
Slider in the graphics window. Value changes are printed in the text output.

1 -> 2
2 -> 3
3 -> 4
4 -> 5

See also:

Table of Content