On this page:
control
view
connect

1.15 An Arrow GUI: "arrow-gui.ss"

 (require htdp/arrow-gui)

The teachpack provides functions for creating and manipulating an arrow GUI. We recommend using 2htdp/universe instead.

modelT (-> button% event% true)

A modelT is a function that accepts and ignores two arguments.

Reads out the current state of the message field.

(view s)  true
  s : (or/c string? symbol?)
Displays s in the message field.

(connect l r u d)  true
  l : modelT
  r : modelT
  u : modelT
  d : modelT
Connects four controllers with the four directions in the arrow window.

Example:
; Advanced
(define (make-model dir)
   (lambda (b e)
     (begin
       (view dir)
       (printf "~a ~n" (control)))))
 
(connect
   (make-model "left")
   (make-model "right")
   (make-model "up")
   (make-model "down"))
Now click on the four arrows. The message field contains the current direction, the print-out the prior contents of the message field.