Create a button

button text size
(button text size [instructions])
(button text size function)

Creates a button in the graphics output window with the text as a caption. Size is a two- or four-element collection; 1st and 2nd element is the position with respect to the left and top borders of the window, respectively; 3rd and 4th element (if present) is the width and the height of the button, respectively. Size and location are given in pixels and do not depend on the drawing scales.

Pushing a button creates an event which may be handled by a list of instructions or a function passed as an optional argument of button. Event handler can be configured also with setonclick instruction.

Example:

"n := 0
"b := (button "OK {30 20 60 24} ["n := :n + 1 print :n])

Output:
"OK" button in the graphics output window; consecutive numbers are written to the text output each time the button is pressed.

1
2
3
...

See also:

Table of Content