Teachpacks

1`` | Ht DP Teachpacks
2`` | Ht DC Teachpacks

On this page:

control
view
connect

Version: 4.0.2
contents
← prev up next →

#### 1.13`` An Arrow GUI: arrow-gui.ss

The teachpack provides operations for creating and manipulating an arrow GUI. We recommend using the world teachpack instead.

modelT (-> button% event% true)

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

(control) → symbol?

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:

; A d v a n c e d
(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.

contents
← prev up next →