On this page:
control
view
connect

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

 (require htdp/arrow-gui) package: htdp-lib

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.

procedure

(control)  symbol?

Reads out the current state of the message field.

procedure

(view s)  true

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

procedure

(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.