在本页中:
control
view
connect

1.18 猜测GUI: "guess-gui.rkt"

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

本教学包提供三个函数:

函数

(control index)  symbol?

  index : natural-number?
读出第index个猜测选项,从0开始计数

函数

(view msg)  true/c

  msg : (or/c string? symbol?)
在消息面板(message panel)中显示msg参数

函数

(connect handler)  true/c

  handler : (-> button% event% true/c)
连接控制函数(handler)和Check按钮

例如:
(connect (lambda (e b)
           (begin
             (printf "0th digit: ~s~n" (control 0))
             (view (control 0)))))