GUI


gui.ss

The teachpack gui.ss provides the following operations:

  • show-window : -> true
    to show the window
  • hide-window : -> true
    to hide the window
  • create-window : (listof (listof gui-item)) -> true
    to add gui-items to a window and to show the window
    each list of gui-items defines one row of gui items in the window
  • make-button : str (event% -> boolean) -> gui-item
    to create a button with label and call-back function
  • make-message : str -> gui-item
    to create an item that displays a message
  • draw-message : gui-item[message%] -> true
    to display a message in a message item
    it earses the current message
  • make-text : str -> gui-item
    to create an item (with label) that allows users to enter text
  • text-contents : gui-item[text%] -> str
    to determine the contents of a text field
  • make-choice : (listof str) -> gui-item
    to create a choice menu that permits users to choose from some string alternatives
  • choice-index : gui-item[choice%] -> num
    to determine which choice is currently selected in a choice-item
    the result is the 0-based index in the choice menu
  • Example:

    > (create-frame (list (list (make-button "QUIT" hide-window))))
    
    A button appears on the screen. Click on the button and it will disappear.
    > (show-window)
    
    The frame reappears.