racket/collects/teachpack/htdp/scribblings/arrow-gui.scrbl
Eli Barzilay afad5af486 * Added a `teachpack' function to do teachpack titles
* Made it add "foo teachpack" as an index entry

svn: r10687
2008-07-09 02:28:20 +00:00

46 lines
1.3 KiB
Racket

#lang scribble/doc
@(require scribble/manual "shared.ss"
(for-label scheme
teachpack/htdp/arrow-gui))
@teachpack["arrow-gui"]{An Arrow GUI}
@declare-exporting[teachpack/htdp/arrow-gui]
The teachpack provides operations for creating and manipulating an arrow
GUI. We recommend using the @seclink["world"]{world teachpack} instead.
@deftech{modelT} @scheme[(-> button% event% true)]
A @tech{modelT} is a function that accepts and ignores two arguments.
@defproc[(control) symbol?]{Reads out the current state of the message
field.}
@defproc[(view [s (or/c string? symbol?)]) true]{Displays @scheme[s] in the
message field.}
@defproc[(connect [l (unsyntax @tech{modelT})][r (unsyntax @tech{modelT})][u (unsyntax @tech{modelT})][d (unsyntax @tech{modelT})]) true]{Connects four
controllers with the four directions in the arrow window.}
Example:
@(begin
#reader scribble/comment-reader
(schemeblock
;; 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.