► |  | How to Design Programs Teachpacks

1 | Ht DP Teachpacks
2 | Ht DP/ 2e Teachpacks

▼ | 1 | Ht DP Teachpacks

1.1 | Manipulating Images: "image.rkt"
1.2 | Simulations and Animations: "world.rkt"
1.3 | Converting Temperatures: "convert.rkt"
1.4 | Guessing Numbers: "guess.rkt"
1.5 | Master Minding: "master.rkt"
1.6 | Playing Master Mind: "master-play.rkt"
1.7 | Simple Drawing: "draw.rkt"
1.8 | Hangman: "hangman.rkt"
1.9 | Playing Hangman: "hangman-play.rkt"
1.10 | Managing Control Arrows: "arrow.rkt"
1.11 | Manipulating Simple HTML Documents: "docs.rkt"
1.12 | Working with Files and Directories: "dir.rkt"
1.13 | Graphing Functions: "graphing.rkt"
1.14 | Simple Graphical User Interfaces: "gui.rkt"
1.15 | An Arrow GUI: "arrow-gui.rkt"
1.16 | Controlling an Elevator: "elevator.rkt"
1.17 | Lookup GUI: "lkup-gui.rkt"
1.18 | Guess GUI: "guess-gui.rkt"
1.19 | Queens: "show-queen.rkt"
1.20 | Matrix Functions: "matrix.rkt"

On this page:

control
view
connect

top ← prev up next →

#### 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.
top ← prev up next →