Arrows GUI


arrow-gui.ss

The teachpack arrow-gui.ss implements three functions:

  • control : -> symbol
    to read out the current state of the msg field
  • view : (union string symbol) -> true
    to display its argument in the message panel
  • modelT = (button% event% -> true)
    connect : modelT modelT modelT modelT -> true
    to connect four controllers with the four directions in the arrow window
  • Example:

    > (define (make-model dir)
       (lambda (b e)
         (printf (format "~a" (control)))
         (view dir)))
    
    > (connect
       (make-model "west")
       (make-model "east")
       (make-model "north")
       (make-model "south"))  
    
    Now click on the four arrows. The message field will contain the current direction, the print-out the prior contents of the message field.