Blame


1 12687dd9 2023-08-04 jrmu ;; The first three lines of this file were inserted by DrScheme. They record metadata
2 12687dd9 2023-08-04 jrmu ;; about the language level of this file in a form that our tools can easily process.
3 12687dd9 2023-08-04 jrmu #reader(lib "htdp-intermediate-reader.ss" "lang")((modname |22.3|) (read-case-sensitive #t) (teachpacks ((lib "draw.ss" "teachpack" "htdp") (lib "arrow.ss" "teachpack" "htdp") (lib "gui.ss" "teachpack" "htdp"))) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ((lib "draw.ss" "teachpack" "htdp") (lib "arrow.ss" "teachpack" "htdp") (lib "gui.ss" "teachpack" "htdp")))))
4 12687dd9 2023-08-04 jrmu
5 12687dd9 2023-08-04 jrmu (define (change-text event)
6 12687dd9 2023-08-04 jrmu (draw-message main-message (text-contents main-text)))
7 12687dd9 2023-08-04 jrmu (define (change-choice event)
8 12687dd9 2023-08-04 jrmu (cond
9 12687dd9 2023-08-04 jrmu [(= (choice-index main-choice) 0) (draw-message main-choice-message "Please make a selection")]
10 12687dd9 2023-08-04 jrmu [(= (choice-index main-choice) 1) (draw-message main-choice-message "Let's shop another time")]
11 12687dd9 2023-08-04 jrmu [(= (choice-index main-choice) 2) (draw-message main-choice-message "There's nothing interesting on TV")]
12 12687dd9 2023-08-04 jrmu [(= (choice-index main-choice) 3) (draw-message main-choice-message "Sure, we're programming right now!")]
13 12687dd9 2023-08-04 jrmu [(= (choice-index main-choice) 4) (draw-message main-choice-message "Maybe in 2 hours!")]))
14 12687dd9 2023-08-04 jrmu (define (close-main-window event)
15 12687dd9 2023-08-04 jrmu (hide-window main-window))
16 12687dd9 2023-08-04 jrmu
17 12687dd9 2023-08-04 jrmu (define main-message (make-message "Hi, nice to meet you too!"))
18 12687dd9 2023-08-04 jrmu (define query (make-message "What would you like to do today?"))
19 12687dd9 2023-08-04 jrmu (define main-text (make-text "Hi Aaron!"))
20 12687dd9 2023-08-04 jrmu (define main-choice-message (make-message ""))
21 12687dd9 2023-08-04 jrmu (define main-choice (make-choice (list "Make a selection"
22 12687dd9 2023-08-04 jrmu "Go Shopping"
23 12687dd9 2023-08-04 jrmu "Watch TV"
24 12687dd9 2023-08-04 jrmu "Program Scheme"
25 12687dd9 2023-08-04 jrmu "Sleep")))
26 12687dd9 2023-08-04 jrmu (define main-window
27 12687dd9 2023-08-04 jrmu (create-window
28 12687dd9 2023-08-04 jrmu (list (list (make-button "Close Window" close-main-window))
29 12687dd9 2023-08-04 jrmu (list (make-button "Change Text" change-text)
30 12687dd9 2023-08-04 jrmu main-text main-message)
31 12687dd9 2023-08-04 jrmu (list query)
32 12687dd9 2023-08-04 jrmu (list main-choice
33 12687dd9 2023-08-04 jrmu (make-button "Go!" change-choice))
34 12687dd9 2023-08-04 jrmu (list main-choice-message))))
35 12687dd9 2023-08-04 jrmu
36 12687dd9 2023-08-04 jrmu