The teachpack provides operations for creating and manipulating graphical user interfaces. We recommend using the world teachpack instead.
Window A Window is a data representation of a visible window on your computer screen.
GUI-ITEM A GUI-Item is a data representation of an active component of a window on your computer screen.
|> (define w|
|(list (list (make-button "QUIT" (lambda (e) (hide-window w)))))))|
|; A button appears on the screen.|
|; Click on the button and it will disappear.|
|> (show-window w)|
|; The window disappears.|
|; text1 : GUI-ITEM|
|(make-text "Please enter your name"))|
|; msg1 : GUI-ITEM|
|(make-message (string-append "Hello, World" (make-string 33 #\space))))|
|; Event -> true|
|; draws the current contents of text1 into msg1, prepended with "Hello, "|
|(define (respond e)|
|(draw-message msg1 (string-append "Hello, " (text-contents text1))))|
|; set up window with three "lines":|
|; a text field, a message, and two buttons|
|; fill in text and click OKAY|
|(list (make-button "OKAY" respond)|
|(make-button "QUIT" (lambda (e) (hide-window w)))))))|