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

► |  | Teachpacks

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

▼ | 1 | Ht DP Teachpacks

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

On this page:

control
view
connect

top← 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:

; 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 →